GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — bpo-37319: Deprecated support of non-integer arguments in random.randrange(). by serhiy-storchaka · Pull Request #19112 · python/cpython Conversation
|
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Looks like this is good to close from the discussion on https://bugs.python.org/issue37319 ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Reopened because @rhettinger just opened a duplicate issue. According to the same microbenchmark as in #23064, this PR provides a 10% speed up: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| except TypeError: | ||
| istep = int(step) | ||
| if istep != step: | ||
| raise ValueError("non-integer step for randrange()") |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
While we're at it, the exception type should be converted to TypeError.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should we raise it with custom message or reraise the exception raised by index()?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@rhettinger, what are your problems with this PR? I addressed your comments, and would appreciate any other suggestions. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I merged in PR 23064. If you want to make further modifications or improvements that would be welcome. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9e238e7 to
5749575
Compare
|
I merged with master. Please make review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.