[issue35200] Make the half-open range behaviour easier to teach

Julien Palard report at bugs.python.org
Sun Nov 18 16:43:02 EST 2018


Julien Palard <julien+python at palard.fr> added the comment:

My first though went to giving something really simple like:

>>> print(range(10))
1, 2, ..., 8, 9

But for the empty range it would give an empty string. It may make sense, but may also be surprising.

The other way would be to print [1, 2, ..., 8. 9], so the empty range gets [] instead of nothing.

I think I prefer the first way.

----------

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


More information about the Python-bugs-list mailing list