[Python-iterators] Re: PEP 234: Iterators
aleaxit at yahoo.com
Tue May 1 21:42:24 CEST 2001
"Guido van Rossum" <guido at digicool.com> wrote in message
news:mailman.988716782.29093.python-list at python.org...
> iterators. E.g. here's an iterator that gives the even-numbered items
> of an argument iterator:
> class EvenIterator:
> def __init__(self, it):
> self.it = it
If I understand the PEP correctly, wouldn't
self.it = iter(it)
be better here? Idempotent if 'it' is already an iterator, good if
'it' is a sequence instead?
More information about the Python-list