Integers class...?

Bernhard Herzog bh at intevation.de
Fri Mar 8 07:07:03 EST 2002


Greg Ewing <greg at cosc.canterbury.ac.nz> writes:

> The only thing you don't get from that is an
> easy way to iterate backwards. The best I can
> think of is
> 
>   for x in reverse(ints[0:11]):

Slices support a step parameter, so

    for x in int[9:-1:-1]:

should work, I think. Whether this is really so much more convenient
than range or xrange is a different matter. The fact that this new
feature could be defined to create an iterator could be an advantage,
tough.


   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                           http://www.mapit.de/



More information about the Python-list mailing list