PEP 234: Iterators

Roman Suzi rnd at onego.ru
Wed May 2 09:05:22 EDT 2001


On Wed, 2 May 2001, Just van Rossum wrote:

>Roman Suzi wrote:
>> On 2 May 2001, Michael Hudson wrote:
>> >"Peter Caven" <p.caven at ieee.org> writes:
>> >> I really like the idea of returning different kinds of iterators for
>> >> dictionaries as described:
>> >>
>> >> >           for key, value in dict.iteritems(): ...
>> >> >           for value in dict.itervalues(): ...
>> >> >           for key in dict.iterkeys(): ...
>> >
>> >Me too.
>>
>> What about xitems, xvalues, xkeys (as in xrange?)
>
>Please read the PEP: iterators largely make these redundant. Eg. dict.iteritems()
>doesn't return a list of items (we already have dict.items() for that) but an
>_iterator_, allowing you to iterate over the items _without_ creating a list
>containing them all...

I mean, will not be xrange renamed to iterrange - it must be also
an iterator, or will it stay as is, with special xrange object
instead of iterator?

I mean, if explicit iterators are introduced to Python, why not to
change xrange into iterator for uniformity, in the same PEP?

>Just

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Wednesday, May 02, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Cats have nine lives - but sleep through eight of them." _/






More information about the Python-list mailing list