On Sun, 3 May 2015 08:33 am, BartC wrote:

> OK, so it's just an irritation then, as a workaround has been available
> for a long time. (For example, if you use xrange, it won't work on 3.x.
> If you use range, then it might be inefficient on 2.x.)


That is trivially easy to deal with. Put this at the top of your module:

try:
    xrange
except NameError:
    xrange = range


and then use xrange throughout the module. Or if you prefer:

try:
    range = xrange
except NameError:
    pass

and just use range.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to