xrange issue 7721

Martin Manns mmanns at gmx.net
Sat May 29 15:12:41 EDT 2010


On Sat, 29 May 2010 19:46:28 +0100
Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:

> I've had an OverflowError using xrange with Python 2.6.5 on Windows. 
> Googling got me to the subject line.
> 
> msg97928 gives a code snippet to overcome the limitations of xrange, 
> allowing for negative steps, however it doesn't raise a ValueError
> for a zero step. msg99624 gives a docs change that has been
> implemented for V2.6, but this doesn't refer to the msg97928 code
> snippet, rather it refers to a one liner that only works for positive
> steps.  The docs for V2.7 haven't been changed at all.

Mark:

Thank you for posting.

2.7 is not affected by issue 7721 because itertools.islice behavior is
changed. Therefore, the original snippet should work in 2.7 (I have not
tested this).

I found the msg97928 code pretty obvious when seeing the snippet. 
If you disagree you may consider re-opening the issue.

Martin




More information about the Python-list mailing list