PEP 234: Iterators

Roman Suzi rnd at onego.ru
Wed May 2 10:53:26 EDT 2001


On 2 May 2001, Michael Hudson wrote:

>com-nospam at ccraig.org (Christopher A. Craig) writes:
>
>> 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

exactly.

>> xitems, xvalues, and xkeys instead of iteritems, itervalues, and
>> iterkeys would be inline with names of the present xrange and
>> xreadlines functions.
>
>But .iteritems(), etc. are much better names.  So there.

Are them?  x* names are more visible in the code code.
I ca argue that iteitems must be spelled as
"iter_items", to be like has_key, otherwise, there could be
some mis-styling in them?

"isoteritems" ;-)

>Cheers,
>M.

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