Brett Cannon wrote:
> On 3/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
>> (Off-topic: maybe we can drop the fall-back behavior
>> of iter() if __iter__ isn't found?)
>>
>
> I say yes. Iterators will be common enough that objects that want the
> support should just directly support it.
Hmm, I'd expect the typical generator used for this to be a fair bit slower
than the current custom sequence iterator:
def __iter__(self):
for i in range(len(self)):
yield i
OTOH, it would make sense if the fallback could instead be written:
__iter__ = itertools.iterseq
(where 'iterseq' gives a real name to the currently hidden default sequence
iterator)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
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