PEP 234: Iterators

Christian Tanzer tanzer at swing.co.at
Fri May 4 09:17:06 CEST 2001


"Stephen Hansen" <news at myNOSPAM.org> wrote:

>    dict.iteritems/iterkeys/itervalues is still really ugly, though. :)

Yes it is.

I'd call them item_iterator (or itemiter), key_iterator, and
value_iterator.

I can't explain why but putting `iter' first in the name makes it less
readable to me.

Also consider things like `range_iterator'/`rangeiter' (analogous to
xrange) and `pair_iterator'/`pairiter' (lockstep iterator over two
sequences) vs. `iterrange' and `iterpair'. `iterrange' and `iterpair'
definitely convey the wrong semantics (i.e., a range/pair of
iterators instead of a iterator over a range/pair).

-- 
Christian Tanzer                                         tanzer at swing.co.at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92





More information about the Python-list mailing list