Message383930
Another solution is to use an identity test for the step argument
_one = 1
class Random:
def randrange(start, stop=None, step=_one):
...
if stop is None and step is _one:
if istart > 0:
return self._randbelow(istart)
This has the advantage of keeping the API unchanged while still keeping the fast path fast. |
|
Date |
User |
Action |
Args |
2020-12-28 21:06:51 | rhettinger | set | recipients:
+ rhettinger, tim.peters, serhiy.storchaka |
2020-12-28 21:06:51 | rhettinger | set | messageid: <1609189611.52.0.500868166925.issue42772@roundup.psfhosted.org> |
2020-12-28 21:06:51 | rhettinger | link | issue42772 messages |
2020-12-28 21:06:51 | rhettinger | create | |
|