Pre-PEP: reverse iteration methods

Andrew Dalke adalke at mindspring.com
Wed Sep 24 18:05:01 EDT 2003


Me:
> The only two I can think of are:

>        for i in range(len(obj)-1, -1, -1):  yield obj[i]

Peter Otten proposed a nice variation; assume negative
indicies work.  Then there's no need to assume len
works.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list