PEP 276 (was Re: Status of PEP's?)

Carel Fellinger cfelling at iae.nl
Sat Mar 2 13:17:25 EST 2002


David Eppstein <eppstein at ics.uci.edu> wrote:
> In article <a5ptsb$99s16$1 at ID-11957.news.dfncis.de>,
...
> But that wouldn't be as useful for iterating backwards through lists.
> Which is what most of this seems to be directed at, rather than anything to 
> do with integers per se, so I wonder why we are trying to convert integers 
> into lists of indices rather than converting the lists directly.

But then you would need yet another parameter to an enhanced range or
the yet to come indici to indicate you want to iterate in reverse, like:

    for i in range("spam", reverse=1): pass
    for in in indici("spam", reverse=1): pass

The nicety of the enhanced iterating-integers proposal is that it gives
a very easy spelling of two of the more frequent usages of iterating
over the (range of the:) length of something once you accept that
integers can count (up/down) and that `count' is spelled `iter' in
Python.  Still haven't made up my mind on that last one:)

-- 
groetjes, carel



More information about the Python-list mailing list