[New-bugs-announce] [issue36693] Minor inconsistancy with types.

Donald Hobson report at bugs.python.org
Sun Apr 21 12:28:47 EDT 2019


New submission from Donald Hobson <donaldphobson at yahoo.co.uk>:

Almost all of python makes the abstraction that ints are a single type of thing, the fact that some ints are too big to store in 8 bytes of memory is abstracted away. This abstraction fails when you try to reverse large ranges. 

>>> reversed(range(1<<63))
<longrange_iterator object at 0x7f0925d26660>
>>> reversed(range(1<<63-1))
<range_iterator object at 0x7f0925d26600>
>>> type(reversed(range(1<<63-1)))
<class 'range_iterator'>
>>> type(reversed(range(1<<63)))
<class 'longrange_iterator'>
>>> type(reversed(range(1<<63-2)))==type(reversed(range(1<<63-1)))
True
>>> type(reversed(range(1<<63-1)))==type(reversed(range(1<<63)))
False

----------
components: Interpreter Core
messages: 340614
nosy: Donald Hobson
priority: normal
severity: normal
status: open
title: Minor inconsistancy with types.
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36693>
_______________________________________


More information about the New-bugs-announce mailing list