Message383776
There is another randrange() oddity. If stop is None, the step argument is ignored:
>>> randrange(100, stop=None, step=10)
4
If we want to fully harmonize with range(), then randrange() should only accept positional arguments and should not allow None for the stop argument. That would leave the unoptimized implementation equivalent to:
def randrange(self, /, *args):
return self.choice(range(*args))
The actual implementation can retain its fast paths and have a nicer looking signature perhaps using __text_signature__. |
|
Date |
User |
Action |
Args |
2020-12-25 22:38:51 | rhettinger | set | recipients:
+ rhettinger, tim.peters, terry.reedy, serhiy.storchaka, veky |
2020-12-25 22:38:51 | rhettinger | set | messageid: <1608935931.66.0.906835422809.issue42222@roundup.psfhosted.org> |
2020-12-25 22:38:51 | rhettinger | link | issue42222 messages |
2020-12-25 22:38:51 | rhettinger | create | |
|