[issue42772] randrange() mishandles step when stop is None
Raymond Hettinger
report at bugs.python.org
Wed Dec 30 20:28:29 EST 2020
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
Upon further reflection, I think these cases should raise a TypeError because the meaning is ambiguous:
randrange(1000, step=10) # Could only mean start=0 stop=1000 step=10
but that conflicts with:
randrange(1000, None, 100) # Has no reasonable interpretation
For comparison, this currently raises a TypeError because None isn't a sensible argument for stop:
range(1000, None, 100)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42772>
_______________________________________
More information about the Python-bugs-list
mailing list