PEP 322: Reverse Iteration (REVISED, please comment)
Werner Schiendl
n17999950.temp.werner at neverbox.com
Tue Oct 28 14:27:33 EST 2003
Raymond Hettinger wrote:
>
> 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.
>
Which of course can easily be done explicitely:
# Make some iterable unsuitable for inreverse
a = iter("Hello")
# Create a list that can be in'reversed explicitely
for i in inreverse(list(a)):
print i
As always, explicit is better than implicit ;-)
Maybe something alike should go into the docs...
- Werner
More information about the Python-list
mailing list