[Python-ideas] Add irange with large integer step support to itertools
dickinsm at gmail.com
Mon Jan 10 09:27:30 CET 2011
On Fri, Jan 7, 2011 at 10:24 AM, Martin Manns <mmanns at gmx.net> wrote:
> I would like to propose an addition of an "irange" function to
> itertools. This addition could reduce testing effort when developing
> applications, in which large integers show up.
> Both, xrange (Python 2.x) and range (Python 3.x) have limited support
> for large integer step values, for example:
> Python 3.1.3 (r313:86834, Nov 28 2010, 10:01:07)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> range(10**10000, 10**10000+10**1000, 10**900)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> OverflowError: Python int too large to convert to C ssize_t
This example strikes me as a bug in range (specifically, in
range_subscript in Objects/rangeobject.c).
> Does such an addition make sense in your eyes?
Wouldn't it be better to fix 'range' to behave as expected?
More information about the Python-ideas