Guido van Rossum wrote:
>On 7/20/06, Walter Dörwald <[EMAIL PROTECTED]> wrote:
>
>
>>str and unicode don't have __iter__, list, tuple and dict do:
>>
>>
>[...]
>
>
>>Should that be fixed too?
>>
>>
>
>Yes, please. (In Python 2.6 if you can.)
>
>
>
Why is the a defect? Have we abandoned the notion of SeqIter
automatically wrapping any object with __getitem__()?
IIRC, list and tuple have __iter__ simply as optimizations, it did not
change their functionality.
Raymond
-----------------
>>> class X:
def __getitem__(self, i):
if i < 5:
return i*5
raise IndexError
>>> for i in X():
print i
0
5
10
15
20
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com