[issue28880] range(i, j) doesn't work

Matthew Barnett report at bugs.python.org
Mon Dec 5 13:42:56 EST 2016


Matthew Barnett added the comment:

Not a bug.

Python 2 had 'range', which returned a list, and 'xrange', which returned an xrange object which was iterable:

>>> range(7)
[0, 1, 2, 3, 4, 5, 6]
>>> xrange(7)
xrange(7)
>>> list(xrange(7))
[0, 1, 2, 3, 4, 5, 6]

In Python 3, 'range' was dropped and 'xrange' was renamed to 'range':

>>> range(7)
range(0, 7)
>>> list(range(7))
[0, 1, 2, 3, 4, 5, 6]

BTW, that's not the Windows command prompt, that's the Python prompt.

----------
components: +Interpreter Core -Regular Expressions

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


More information about the Python-bugs-list mailing list