PEP 322: Reverse Iteration (REVISED, please comment)
python at rcn.com
Tue Oct 28 19:22:44 CET 2003
Based on your extensive feedback, PEP 322 has been completely revised.
The response was strongly positive, but almost everyone preferred
having a function instead of multiple object methods. The updated
proposal is at:
In a nutshell, it proposes a builtin function that greatly simplifies reverse
iteration. The core concept is that clarity comes from specifying a
sequence in a forward direction and then saying, "inreverse()":
for elem in inreverse(seqn):
. . .
Unlike seqn[::-1], this produces a fast iterator instead of a full reversed
Discussions with Guido made it clear that inreverse() will not be extended
to cover all iterables. The proposal is about simplicity, expression, and
performance. As such, it would be counter-productive to take in a general
iterable, run it to completion, save the data in memory, and then iterate
over the data in reverse.
More information about the Python-list