PEP 234: Iterators

Roman Suzi rnd at onego.ru
Wed May 2 12:17:27 EDT 2001


>> 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...
>
>Perhaps it's only a matter of naming? How about itemIterator(),
>valueIterator(), etc (or itemiter() if you don't like camelcase)

Or yes, I forgot:


for childs in xmlDoc.iter("child"):

for sibling in xmlDoc.iter("sibling"):

for i in list.iter(recursive=1):

for (k, v) in dict.iter(("key", "value")):

and so on!

(Am I dreaming too much?)

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