Uh oh!
There was an error while loading. Please reload this page.
bpo-37319: Deprecated support of non-integer arguments in random.randrange(). - #19112
Conversation
rhettinger
commented
Mar 22, 2020
I don't think this should be done. It churns an API that has been stable for two decades. It doesn't solve a real problem. It may break working code. It makes the code look gross. It will complicate maintenance. |
Uh oh!
There was an error while loading. Please reload this page.
alimcmaster1
commented
Apr 11, 2020
Looks like this is good to close from the discussion on https://bugs.python.org/issue37319 ? |
serhiy-storchaka
commented
Oct 31, 2020
Reopened because @rhettinger just opened a duplicate issue. According to the same microbenchmark as in #23064, this PR provides a 10% speed up: |
| except TypeError: | ||
| istep = int(step) | ||
| if istep != step: | ||
| raise ValueError("non-integer step for randrange()") |
There was a problem hiding this comment.
While we're at it, the exception type should be converted to TypeError.
There was a problem hiding this comment.
Should we raise it with custom message or reraise the exception raised by index()?
serhiy-storchaka
commented
Dec 24, 2020
@rhettinger, what are your problems with this PR? I addressed your comments, and would appreciate any other suggestions. |
rhettinger
commented
Dec 28, 2020
I merged in PR 23064. If you want to make further modifications or improvements that would be welcome. |
9e238e7 to
5749575Compareserhiy-storchaka
commented
Dec 29, 2020
I merged with master. Please make review. |
https://bugs.python.org/issue37319