Pre-PEP: reverse iteration methods

sebastien s.keim at laposte.net
Wed Sep 24 03:42:33 EDT 2003


> PEP: 323
> Title: Add Reverse Iteration Methods
> Version: $Revision: 1.1 $

I don't need this often enough to want it as a method or a builtin
function.
But it would ne nice to have a function in the itertool module.

I would call it riter(), it should work on any sequence with len()
support or on any object wich define the __riter__ special method.

In practice, I mostly use reverse  iteration when I most remove some
few objects on the sequence I'm itering to, so I have more neeed for a
renumerate() function:

for index, value in itertools.renumerate(sequence):
      if not value:
            del sequence(index)




More information about the Python-list mailing list