[Python-checkins] r42718 - peps/trunk/pep-3000.txt

Raymond Hettinger python at rcn.com
Wed Mar 1 06:50:28 CET 2006


> -* Return iterators instead of lists where appropriate for atomic type methods
> -  (e.g. ``dict.keys()``, ``dict.values()``, ``dict.items()``, etc.)
> -  (Do we keep iter*() methods or remove them?  I vote remove. -- nn)

The last line doesn't make sense to me.  I had thought the direction was to keep 
simple names like range(), dict.items(), dict.keys(), and dict.values() and have 
them return an iterator instead of a list.  When that is done, then the current 
iterator versions will be redundant and we can kill-off the weird names like 
xrange(), dict.iter_items(), dict.iter_keys(), and dict.iter_values().

IOW, we still need some method to iterator over dictionary items and the name 
should be dict.items() rather than the long-winded, dict.iter_items()


Raymond



More information about the Python-checkins mailing list