PEP 234: Iterators
Aahz Maruch
aahz at panix.com
Thu May 3 14:39:22 EDT 2001
In article <87ae4v3nju.fsf at elbereth.ccraig.org>,
Christopher A. Craig <com-nospam at ccraig.org> wrote:
>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.
Well, yes. The whole point of this exercise is that xrange() will be
essentially deprecated in 2.2. There's no more need to create any new
x*() functions.
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het Pythonista http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
I don't have enough time for all the cool people I know, let alone all
the cool people *they* know. --Aahz
More information about the Python-list
mailing list