[Python-Dev] PEP 322: Reverse Iteration

Moore, Paul Paul.Moore at atosorigin.com
Tue Nov 4 09:41:11 EST 2003


From: Guido van Rossum [mailto:guido at python.org]
> Such a thing would face zero opposition if it was part of itertools:
> itertools.revrange([start, ] stop[, step]) makes total sense to me...

I also like Alex's suggestion of
    itertools.irange([start,] stop[, step][,reverse=False])

I'd rather this than a revrange - that feels over-specialised, whereas
an irange with a reverse keyword parameter seems natural.

I'd still support this addition to itertools whether or not the reversed()
builtin was implemented (although with irange, reversed() loses a lot of
its use cases...)

Paul.



More information about the Python-Dev mailing list