On 9/5/05, Stuart Bishop [EMAIL PROTECTED] wrote:
Urgh... I hadn't noticed that in vocabularies before. I believe this has
other side effects too, such as if I do list(mysource), Python calls
mysource.__len__ (if it exists) to preallocate the list size. Wierd things
can happen if your class
[Fred Drake, on returning sys.maxint from __len__ if you don't know
the length, which Tim strongly advises against]
Interesting. I seem to remember this coming from Guido several times
in discussions.
Not me. Googling on
site:mail.python.org maxint __len__ guido
finds 9 hits, all
Stuart Bishop wrote:
If this is a way of saying I'm iterable, but I don't want to tell you how
long I am
Right.
shouldn't an exeption be raised? Otherwise 'for i in range(0,len(source)):
foo = source[i]' could start blowing up if the source changes.
Of course, that particular spelling
Benji York wrote:
Stuart Bishop wrote:
If this is a way of saying I'm iterable, but I don't want to tell you
how
long I am
Right.
shouldn't an exeption be raised? Otherwise 'for i in
range(0,len(source)):
foo = source[i]' could start blowing up if the source changes.
Of