iterating in reverse
Erik Max Francis
max at alcyone.com
Thu Jan 16 19:24:20 EST 2003
"Jonathan P." wrote:
> Is there an elegant and
> efficient way to iterate through x in
> reverse without having to create a reversed
> copy of it (i.e. y=x[:]; y.reverse())?
It's not too elegant, but
for j in range(len(x) - 1, -1, -1):
i = x[j]
print i
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ All the people in his neighborhood turn around and get mad and sing
\__/ Public Enemy
Bosskey.net: Return to Wolfenstein / http://www.bosskey.net/rtcw/
A personal guide to Return to Castle Wolfenstein.
More information about the Python-list
mailing list