Problem with Python xrange
tjreedy at udel.edu
Tue Jun 8 18:05:42 CEST 2004
"Konstantin Veretennicov" <kveretennicov at yahoo.com> wrote in message
news:5155aad2.0406080709.698cba47 at posting.google.com...
> As other posters have pointed out, slicing xrange object doesn't yield
> appropriate x(sub)range but raises exception instead. According to PEP
> 260 xrange slicing is a "rarely used behavior".
It is also slight ambigous. Should the result be a list or another xrange?
> You have at least three alternatives:
4) Use range or xrange directly to get the list or xrange you want. Of
course, you have to know the start, stop, and step values, or use the
deprecated attributes of the original xrange.
Terry J. Reedy
More information about the Python-list