PEP 276 Simple Iterator for ints (fwd)

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Nov 27 23:57:25 EST 2001


James_Althoff at i2.com wrote:
> 
> Since this looks like a suggestion for replacing xrange in the general
> case, did you have any thoughts on how one might specify a step value?

Not any particularly good ones. Maybe

   for 0 <= i/3 < 10:

to give 0, 3, 6, 9. But that's probably
a bit too perverse!

I'm inclined to think that if you really
want steps other than 1, you generate them
yourself from an index which is stepped by
1. 

-- 
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