[Tutor] replacing range with xrange

Andy Cheesman Andy.cheesman at bristol.ac.uk
Mon Jan 28 13:59:12 CET 2008


Hi people,

After watching a nice Google video on Python 3K, and seeing the 
forthcoming removal of range, I've looked at substitution range with 
xrange within my code. Direct substitution works for 90% percent of the 
case (i.e.   for thing in xrange(number):  ), however i can't change the 
example below where I need a non-continuous range. Any suggestions?

Andy

x = range(10)  + range(20, 30)

for thing in x:
    ...



More information about the Tutor mailing list