iterating in reverse

Jonathan P. jbperez808 at yahoo.com
Thu Jan 16 18:46:32 EST 2003


First of all, many thanks to all the people in the list
who have taken the time to respond to my earlier 
questions with excellent answers. Now on to the
problem at hand...

A list's contents are ordered such that:

>>> x=[1,2,3,4,5]

>>> for i in x:
      print i

will always print x's contents in the
same sequence.  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())?




More information about the Python-list mailing list