[issue1533] Bug in range() function for large values

Alexander Belopolsky report at bugs.python.org
Sat May 1 16:48:12 CEST 2010


Alexander Belopolsky <alexander.belopolsky at gmail.com> added the comment:

On Sat, May 1, 2010 at 3:50 AM, Mark Dickinson <report at bugs.python.org> wrote:
>
> Mark Dickinson <dickinsm at gmail.com> added the comment:
>
> Alexander: range *does* still accept such arguments (in 2.7);  just not floats:
>
>>>> from decimal import Decimal
>>>> range(Decimal(20), Decimal(20))
> []

Decimal must be a special case.  With the code attached by OP and
trunk:80673, I get

$ ./python.exe bad_range.py
...
Traceback (most recent call last):
  File "bad_range.py", line 12, in <module>
    print range(MyInt(2**64), MyInt(2**64+10))
TypeError: range() integer start argument expected, got instance.

Same with new style MyInt:

$ ./python.exe bad_range1.py
...
Traceback (most recent call last):
  File "bad_range1.py", line 12, in <module>
    print range(MyInt(2**64), MyInt(2**64+10))
TypeError: range() integer start argument expected, got MyInt.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1533>
_______________________________________


More information about the Python-bugs-list mailing list