PEP 234: Iterators

Christopher A. Craig com-nospam at ccraig.org
Wed May 2 09:09:25 EDT 2001


Just van Rossum <just at letterror.com> writes:
> Roman Suzi wrote:
> > 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...

Much as xrange presently doesn't return a list of items, but an object
that returns the next item with each successive call to __getitem__.
I think his point was that having methods on the mapping objects named
xitems, xvalues, and xkeys instead of iteritems, itervalues, and
iterkeys would be inline with names of the present xrange and
xreadlines functions. 

-- 
Christopher A. Craig <com-nospam at ccraig.org>
"I wouldn't be surprised if the architecture of Intel's microprocessors
were eventually linked to the eventual fall of mankind." Steve Gibson



More information about the Python-list mailing list