Comment on PEP-0322: Reverse Iteration Methods

sebastien s.keim at laposte.net
Thu Sep 25 03:47:06 EDT 2003


The PEP has the following sentence in the rejected alternatives:

> * Add a builtin function, reverse() which calls a magic method, __riter__. 
> I see this as more overhead for no additional benefit.

I believe that this is the better choice because it is the way forward
iteration work in python: you have the iter() function which call a
__iter__ special method.

So, I'd expect to have a riter() function which would call the
__riter__ special method.

I like riter as name to all other alternative because (iter, riter)
looks really like (find, rfind) or (index, rindex) ....

And I still think you don't need it often enough to put it in the
builtin namespace, so the function should go in the itertools module.




More information about the Python-list mailing list