Status of PEP's?

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Mar 3 19:15:41 EST 2002


James_Althoff at i2.com wrote:
> 
> if I want to iterate up (smaller up to larger) I need to
> write the for-loop as
>     for smaller <= i <= larger:  # can *only* iterate up
> but if I want to iterate down (larger down to smaller) I need to write the
> for-loop with the reverse relational operators
>     for larger >= i >= smaller:  # can *only* iterate down

Sorry, I missed that you wanted the order of iteration
to be variable. You're right, but I don't see that as
a major disadvantage. The vast majority of all for-loops
over integers that I write have a fixed iteration order.
In the rare cases that I wanted otherwise, I'd be
quite happy to write the loop another way.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list