-mail to get to a (generally) 1 liner at the bottom.
+1000
People with Hotmail accounts used to be known as "Metoobees" because of
their tendency to reply to long posts with a single line at the very end,
"Me too!".
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
r than choosing between 2 and 4 bytes when
you build the Python compiler.
This is a big positive step forward with a pretty simple algorithm and
will strongly help encourage the use of Unicode by taking much of the
sting out of the perennial complaints that "Unicode wastes space". Not so
wasteful any more.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
then garbage collected, so:
class B:
'''a {} string'''.format('doc')
is equivalent to:
class B:
__doc__ = None
_tmp = '''a {} string'''.format('doc')
del _tmp
except that the name "_tmp" doesn't actually get used.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
expect it to be
more or less equally as efficient, and I find it easier to read:
any(sub in string for sub in substrings)
There's also an all() function that works similarly to any(), except that
it stops as soon as it sees a false value.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
would have
adored as a newbie. (Your mileage may vary.)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
rties, and probably other things as well.
You can do all sorts of funky things with descriptors -- google for
"descriptor protocol", "data descriptor", "non-data descriptor" etc. if
you are interested. Here's a trivial, but useful, one:
http://code.activestate.com/recipes/577030-dualmethod-descriptor/
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ugh I've
already used it for something else, but there is still cost to re-using
names (even if that cost is sometimes trivial).
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
of interfaces, over strict type testing, so users are also
discouraged from writing excessively strongly-typed operations (if you
just need something you can iterate over, why insist that it must be a
list and nothing but a list?).
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
on, only the Ruby people call theirs "call by
reference" and the Java people call theirs "call by value", *both of
which are identical*, and NEITHER of which are the same thing that C and
Pascal programmers will understand by call by value *or* call by
reference.
http://mail.python.org/pipermail/tutor/2010-December/080505.html
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ory locations as "the same sort of entity".
Hence, if C variables are variables, then Python name bindings can't be.
I used to agree with that reasoning. I no longer do, not entirely. While
I see the differences between them -- for instance, C variables exist
before they have a value assigned to them, Python name bindings do not --
I don't think the differences are important enough to *prohibit* use of
the word "variable" to describe name bindings. Only to discourage it.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
e
> types such as strings and numbers, as well as container types. Counted
> references could be used instead, but would be consistently wasted work
> for the garbage collector, though the benefit to programmers' peace of
> mind could be significant.
The usual way to implement &qu
ldn't
> tell what address a variable (or "variable instance", if you prefer) was
> at -- would "int x;" cease to be a variable?
Not at all. Just because the public interface of the language doesn't
give you any way to view the fixed locations of variables, doesn't mean
that variables cease to have fixed locations.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
on 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 42
>>> id(x)
43
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
xmlrunner and unittest discovery, sorry.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 23 Aug 2012 14:22:08 -0500, Evan Driscoll wrote:
> On 08/23/2012 12:56 PM, Steven D'Aprano wrote:
>> On Thu, 23 Aug 2012 12:17:03 -0500, Evan Driscoll wrote:
>>
>>> I definitely *wouldn't* say "Python
>>> classes aren't really clas
On Fri, 24 Aug 2012 08:00:59 +1000, Chris Angelico wrote:
> On Fri, Aug 24, 2012 at 3:56 AM, Steven D'Aprano
> wrote:
>> But name bindings are a kind of variable. Named memory locations are a
>> *different* kind of variable. The behaviour of C variables and Python
>>
On Sat, 25 Aug 2012 22:42:59 -0400, Steven W. Orr wrote:
> win_count = defaultdict(int)
> loss_count = defaultdict(int)
When I try that, I get "NameError: name 'defaultdict' is not defined."
I think it is rather unfair on beginners to show them code that almost,
)
l = losses.get(name, 0)
d = ties.get(name, 0)
total = w+l+d
print(
"Team %s played %d games, won %d, lost %d and tied %d."
% (name, total, w, l, d)
)
If you want to store these results permanently, you need to write them
out to file. You can roll your own, but a simpler way might
99: # + 19
return CLIST
else:
return DLIST
the_list = select_list()
the_item = random.choice(the_list)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
e, to keep in memory this sequence according to the
> *characers* composing this "array of code points".
>
> The message is even stronger. Use runes to work comfortably [*] with
> unicode:
> rune -> int32 -> utf32 -> unicode (the perfect scheme, cann't be better)
Runes are not int32, and int32 is not UTF-32.
Whether UTF-32 is the "perfect scheme" for Unicode is a matter of opinion.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
pose you could. Then the parts of C that don't rely on fixed memory
addresses could use the name bindings (with the corresponding loss of
performance), and the parts of C which do require them could continue to
do so, and we'll have one more language with a confusing, unclear and
uncle
On Sun, 26 Aug 2012 00:45:55 -0500, Evan Driscoll wrote:
> On 08/24/2012 05:00 AM, Steven D'Aprano wrote:
>> No. The compiler remembers the address of 'a' by keeping notes about it
>> somewhere in memory during the compilation process. When you run the
>> comp
On Sun, 26 Aug 2012 23:58:31 +1000, Chris Angelico wrote:
> On Sun, Aug 26, 2012 at 11:43 PM, Steven D'Aprano
> wrote:
>> It gets worse: Python has multiple namespaces that are searched.
>>
>> "Go to the Excelsior Hotel and ask the concierge for Mr Smith. If M
?) But if rune is
merely an alias for int32, why not just call it int32?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 27 Aug 2012 00:54:05 +1000, Chris Angelico wrote:
> On Mon, Aug 27, 2012 at 12:18 AM, Steven D'Aprano
> wrote:
>> Also, built-ins require a name lookup too. As you point out, locals are
>> special, but Python will search an arbitrarily deep set of nested
>>
On Sun, 26 Aug 2012 16:12:40 -0400, Dennis Lee Bieber wrote:
> On 26 Aug 2012 13:43:33 GMT, Steven D'Aprano
> declaimed the following in
> gmane.comp.python.general:
>
>
>
>> (In some older versions of Python, wildcard imports are allowed, and
>> the func
On Sun, 26 Aug 2012 15:42:00 -0600, Ian Kelly wrote:
> On Sun, Aug 26, 2012 at 2:13 PM, Steven D'Aprano
> wrote:
>> On Sun, 26 Aug 2012 09:40:13 -0600, Ian Kelly wrote:
>>
>>> I think the documentation for those functions is simply badly worded.
>>> T
with it:
wget http://www.python.org/ftp/python/src/py152.tgz
tar xzf py152.tgz
cd Python-1.5.2/
./configure
make
sudo make altinstall
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
get right, some might even say buggy.
>> And it would give the python programmer a choice of efficiency
>> profiles.
>
> So instead of having just one test for my Unicode-handling code, I'll
> now have to run that same test *three times* -- once for each possible
&g
for each string as needed. So some
strings will be stored internally as UCS-4, some as UCS-2, and some as
ASCII (which is a standard, but not the Unicode consortium's standard).
(And possibly some as UTF-8? I'm not entirely sure from reading the PEP.)
There's nothing radical here,
On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote:
> In article <[email protected]>,
> Steven D'Aprano wrote:
>
>> The only thing which is innovative here is that instead of the Python
>> compiler declaring that "all
On Thu, 30 Aug 2012 16:44:32 -0400, Terry Reedy wrote:
> On 8/30/2012 12:00 PM, Steven D'Aprano wrote:
>> On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote:
[...]
>>> Is the implementation smart enough to know that x == y is always False
>>> if x an
On Fri, 31 Aug 2012 08:43:55 -0400, Roy Smith wrote:
> In article <[email protected]>,
> Steven D'Aprano wrote:
>
>> On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote:
>> > Is the implementation smart enough to know that x
re *seriously* interested in debugging why string code is slower
for you, you can start by running the full suite of Python string
benchmarks: see the stringbench benchmark in the Tools directory of
source installations, or see here:
http://hg.python.org/cpython/file/8ff2f4634ed8/Tools/stringbench
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 02 Sep 2012 23:38:49 +0300, Serhiy Storchaka wrote:
> On 30.08.12 09:55, Steven D'Aprano wrote:
>> And Python's solution uses those: UCS-2, UCS-4, and UTF-8.
>
> I see that this misconception widely spread.
I am not familiar enough with the C implementation
On Mon, 03 Sep 2012 18:26:02 +0300, Serhiy Storchaka wrote:
> On 03.09.12 04:42, Steven D'Aprano wrote:
>> If you are *seriously* interested in debugging why string code is
>> slower for you, you can start by running the full suite of Python
>> string benchmarks: see th
more complex openers, just call the opener
directly?
What is the rationale for complicating open instead of telling people to
just call their opener directly?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
restart the first iterator
at which point some items returned by the iterator *may* be duplicated or
skipped (depends on the nature of the modifications).
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 03 Sep 2012 21:50:57 -0400, Dave Angel wrote:
> On 09/03/2012 09:26 PM, Steven D'Aprano wrote:
>> An unsigned C int can count up to 4,294,967,295. I propose that you say
>> that is enough iterators for anyone, and use a single, simple, version
>> counter in the
may require fewer, or more, than that,
but whichever way you scan the string, some comparisons will take more
and some will take fewer. With no general way of telling ahead of time
which will be which, on average you can't do better than O(N/2) and no
complexity justification for picking "start from the end" from "start
from the start".
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 03 Sep 2012 23:19:51 -0400, Dennis Lee Bieber wrote:
> On 04 Sep 2012 01:13:09 GMT, Steven D'Aprano
> declaimed the following in
> gmane.comp.python.general:
>
>
>
>> Why does the open builtin need this added complexity? Why not just call
>> os
On Tue, 04 Sep 2012 18:32:57 +0200, Johannes Bauer wrote:
> On 04.09.2012 04:17, Steven D'Aprano wrote:
>
>> On average, string equality needs to check half the characters in the
>> string.
>
> How do you arrive at that conclusion?
Take two non-empty strings
h fewer
The second best thing for your friend to do is to learn to read the index
to the docs, where the print statement is listed:
http://docs.python.org/reference/index.html
You can use your browser's Find command to search the page for "print".
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
nation, although I understand it is much, much
worse now. Blame Google for that.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 04 Sep 2012 18:28:31 +, Steven D'Aprano wrote:
> https://www.google.com.au/search?q=python+print
> http://duckduckgo.com/html/?q=python+print
>
> In this case, google hits the right Python documentation on the first
> link. Duckduckgo doesn't do nearly so wel
ain that what
you are seeing is expected behaviour.
Exceptions should definitely be pickleable:
http://bugs.python.org/issue1692335
so __getstate__ should be called. I think you should report this as a bug.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
)
44
CPython especially has the most complicated behaviour with IDs and object
identity:
>>> a = 99.99
>>> b = 99.99
>>> a is b
False
>>> a = 99.99; b = 99.99; a is b
True
In general, you almost never need to care about IDs and object identity.
The main exception is testing for None, which should always be written as:
if x is None
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
optimization -- something that makes code run slower, not faster).
> and "a==True" should be automatically changed into memory comparison.
Absolutely not. That would be a backward-incompatible change that would
break existing programs:
py> 1.0 == True
True
py> from de
do with the ability of the
timsort algorithm to exploit local order within a list and avoid
performing comparisons.
> In summary, let's please not debate "feelings" or such.
I have no idea what feelings you are referring to.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
rent day computers at least, it is reasonable to say that
"a is b" implies that a and b are the same object at a single location.
The second half of the question is more complex:
"id(a) == id(b)" *only* implies that a and b are the same object at the
same location if the
On Wed, 05 Sep 2012 11:09:30 -0400, Dave Angel wrote:
> On 09/05/2012 10:41 AM, Steven D'Aprano wrote:
[...]
>> So, for current day computers at least, it is reasonable to say that "a
>> is b" implies that a and b are the same object at a single location.
>
>
cted. So you are left with the highly non-random
subset of 1 equality tests.
But you haven't finished. Instead of checking all 1 equality tests,
you then decide to only check the 2000 tests that happen to randomly
occur when using the timsort algorithm to sort a list.
So from the population of one million possible equality tests, you throw
away the vast majority, then average the *strongly non-random* few that
are remaining. Naturally the result you get is strongly biased, and it
has nothing to do with the average Big Oh behaviour of equality on random
strings.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ns in my module that call "open", and I monkey-patch
the global (module-level) name "open" to intercept that call, I don't see
that there is more risk of breakage just because one function is called
from a thread.
Obviously monkey-patching the builtin module itself
" should be special-cased by
the interpreter as "a is True" instead of calling a.__eq__.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
hat from a computer science textbook, but I can't find that
reference now, so possibly I was thinking of something else. (String
searching perhaps?). In any case, the *worst* case for string equality
testing is certainly O(N) (every character must be looked at), and the
*best* case is O(1) obviously (the first character fails to match). But
I'm not so sure about the average case. Further thought is required.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
roven that's where the bottleneck
is." — Rob Pike
"The First Rule of Program Optimization: Don't do it. The Second Rule of
Program Optimization (for experts only!): Don't do it yet." — Michael A.
Jackson
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
e I don't know how it works.
The internal details of how timeit works are complicated, but it is worth
reading the comments and documentation, both in the Fine Manual and in
the source code:
http://docs.python.org/library/timeit.html
http://hg.python.org/cpython/file/2.7/Lib/timeit.py
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
append-a-period-to-a/4329b1f1-746e-4c45-9c32-75622b6ab526
http://support.microsoft.com/kb/115827
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ing a lot of arguing in this thread
> should take Python, find the string comparison routine, and hack in some
> statistics-gathering. Then run *real code* on it.
Where's the fun in that?
:-P
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 06 Sep 2012 06:07:38 -0400, Dave Angel wrote:
> On 09/06/2012 04:33 AM, Steven D'Aprano wrote:
>>
>>
>> I may have been overly-conservative earlier when I said that on average
>> string equality has to compare half the characters. I thought I had
&g
On Fri, 07 Sep 2012 19:10:16 +, Oscar Benjamin wrote:
> On 2012-09-07, Steven D'Aprano
> wrote:
>>
>>
>> After further thought, and giving consideration to the arguments given
>> by people here, I'm now satisfied to say that for equal-length strings,
ir is a string which the operating system will understand to mean
"this directory".
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
es Python 2.7, but when system
tools call "python" they still see the version they are expecting.
If your shell is something other than bash, you may need to use a
different rc file.
Did any of this make sense to you? If anything was unclear, please don't
hesitate to ask.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ympy. See for example:
http://www.sagemath.org/doc/reference/sage/calculus/test_sympy.html
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
one.
http://mail.python.org/pipermail/tutor/2012-September/091388.html
You can see the tutor archives, or subscribe to the list, from here:
http://mail.python.org/mailman/listinfo/tutor
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
bugs can be fixed, but
we're stuck with "referer" forever :)
At least, you should be prepared to justified why your library uthreads
should be considered mature enough for the std lib despite the lack of
real-world use.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 10 Sep 2012 07:36:11 -0400, Dustin J. Mitchell wrote:
> The responses have certainly highlighted some errors in emphasis in my
> approach.
>
> * My idea is to propose a design PEP. (Steven, Dennis) I'm not at *all*
> suggesting including uthreads in the standard
On Mon, 10 Sep 2012 08:59:37 +, Duncan Booth wrote:
> Gelonida N wrote:
>
>> On 09/07/2012 06:06 AM, Steven D'Aprano wrote:
>>> On Thu, 06 Sep 2012 06:07:38 -0400, Dave Angel wrote:
>>>
>>>
>>> Also of some interest is the best case: O
t you do NOT want the name filtered.
>
> Better said by Microsoft:
> "For file I/O, the "\\?\" prefix to a path string tells the Windows APIs
> to disable all string parsing and to send the string that follows it
> straight to the file system.
That's not so much a
On Mon, 10 Sep 2012 15:22:05 -0700, ruck wrote:
> On Monday, September 10, 2012 1:16:13 PM UTC-7, Steven D'Aprano wrote:
[...]
> > That's not so much a workaround as the officially supported API for
> > dealing with the situation you are in. Why don't you just pr
score attributes like self.__spam. This can be a
right PITA at times, and offers so little protection that it isn't
worthwhile. __names only protect against *accidental* name collisions,
and not all of those.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
is idea. I tend to want them in pretty much
> any language I write in.
What do you mean by in-line functions? If you mean what you literally
say, I would answer that Python has that with lambda.
But I guess you probably mean something more like macros.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ter choice.
Everyone has to make that choice for themselves, based on what libraries
they intend to use. For those who don't intend to use any libraries at
all, I think the answer is simple:
Learn the version of Python that comes installed on your computer, or if
you have to install it yourself, learn Python 3.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 12 Sep 2012 02:11:22 +, Steven D'Aprano wrote:
> On Tue, 11 Sep 2012 17:17:14 -0700, Peter wrote:
>
>> If your desire is to "learn" Python then I would stick to 2.7
>>
>> My reasoning would be that there are still a significant number of
>&
this sounds like homework, I won't give you the exact solution. If
you still can't solve it, come back with your attempt and we'll give you
a bit more help.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
lisecond precision -- why??? -- *and* expect
to do it from a user-space application, you're going to have a bad time.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
that your reply will be read a
week after the post you replied to. Do you still expect the reader to
understand what you're talking about?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ttp://code.activestate.com/recipes/251871
and especially the very many useful comments.
In the case of 2), just binhex or uuencode your data for transport.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
-cellphones-missing-dot-kills-two-people-puts-three-more-in-jail
At least tell me that "ASCII only" is merely an *option* for your
application, not the only choice, and that it defaults to UTF-8 which is
the right standard to use for text.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 14 Sep 2012 01:20:53 -0700, alex23 wrote:
> On Sep 14, 6:04 pm, Dwight Hutto wrote:
[snip]
Please don't feed the trolls.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
logging, etc.) you're going to get a much more complex
decorator. On the other hand, YAGNI.
http://en.wikipedia.org/wiki/You_ain%27t_gonna_need_it
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 14 Sep 2012 15:22:26 +0200, Jean-Michel Pichavant wrote:
> Here's Steven example:
>
> # Untested!
> def timeout(t=15):
> # Decorator factory. Return a decorator to actually do the work. if
> FPGA:
> t *= 3
> def decorator(func):
&g
#x27; object has no attribute 'lower'
This tells you that you tried to access something.lower, but "something"
is a list, and lists don't have an attribute or method "lower".
Normally, Python will show you the line of source code with the error, so
y
y that hard to
grasp, so I prefer to see as much of the decorator logic to be in one
place (a nested decorator function) rather than scattered across two
separate decorators plus partial.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
process(arg, default_option)
elif len(args) == 2:
option, arg == args
process(arg, option)
elif len(args) > 2:
do_error('too many arguments')
else:
do_error('not enough arguments')
But as the argument checking code gets more extensive, it is time to just
us
process(arg, default_option)
elif len(args) == 2:
option, arg == args
process(arg, option)
elif len(args) > 2:
do_error('too many arguments')
else:
do_error('not enough arguments')
But as the argument checking code gets more extensive, it is time to just
us
x27;nN' advances iterator N, an exception calls 'assertRaises', and the
> rest are function calls.
[...]
You've proven that even in Python people can write obfuscated code.
> Do you think the 2nd version is legible?
Neither version is even close to legible.
> Could it interfere with the accuracy of the test?
Who knows? I have no clue what your code is doing, it could be doing
*anything*.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
the mailing list will be mirrored on the newsgroup
automatically, there is no need to manually duplicate the post.
Thank you.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 16 Sep 2012 03:15:11 -0700, Νικόλαος Κούρας wrote:
> Whats a mailing list?
> Can i get responses to my mail instead of constantly check the google
> groups site?
http://mail.python.org/mailman/listinfo/python-list
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 16 Sep 2012 03:54:45 -0700, Νικόλαος Κούρας wrote:
> Τη Κυριακή, 16 Σεπτεμβρίου 2012 1:49:38 μ.μ. UTC+3, ο χρήστης Steven
> D'Aprano έγραψε:
>> On Sun, 16 Sep 2012 03:15:11 -0700, Νικόλαος Κούρας wrote:
>>
>>
>>
>> > Whats a mailing list?
>
news reader application". Or use Thunderbird.
For the news server, you use your ISP's newserver, if they offer one, or
Gmane, or any of dozens of commercial news providers who will give you
access to one for a small fee.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
he link before? It has instructions there.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
m, there will be 36
multiplications. If the algorithm is a bit smarter, there will be 19
multiplications.
Either way, when the calculation is dominated by the cost of
multiplication, powerlist3 is between two and four times as expensive as
powerlist1.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
modifications you like, with two requests:
- I would appreciate a comment in the test file acknowledging my
contribution;
- I would like to be notified if you submit this to the bug tracker.
Thanks again for tackling this project.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
n caller's code that it's not the built-in one.
> I'd replace that compound if statement with
> if line.endswith("|\n":
> I'd add a comment saying that partial lines at the end of file are
> ignored.
Or fix the generator so that it doesn't ignore partial lines, or raises
an exception, whichever is more appropriate.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
lows all of the objects to be deleted. But
if you add a __del__ method to *even one* object, Python can no longer
safely break the cycle, and so the objects will remain alive even when
you can no longer reach them from your code.
So, in general, avoid the __del__ method unless you absolutely need it.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
to call you David.
Otherwise, people will continue to call you Dwight.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
'global'
def test():
a = None
locals()['a'] = 'local'
locals()['b'] = 'local'
print a, b
test()
steve@runes:~$ python test.py
None global
steve@runes:~$ jython test.py
None global
steve@runes:~$ ipy test.py
local global
Other Python implementations may do differently.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
nefficient. It depends on the details of the specific strings used, and
the operating system's memory management. When it works, it can make
string concatenation almost as efficient as ''.join(). When it doesn't
work, repeated concatenation is PAINFULLY slow, hundreds or thousands of
times slower than join.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
iven two incompatible arguments: raise an exception.
And in fact, that's exactly what it does.
py> sum ([1, 2, 'a'])
Traceback (most recent call last):
File "", line 1, in
TypeError: unsupported operand type(s) for +: 'int' and 'str'
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
701 - 800 of 15563 matches
Mail list logo