[issue42222] Modernize integer test/conversion in randrange()

2022-02-03 Thread Petr Viktorin
Petr Viktorin added the comment: Since this is a user-visible change in 3.11, could you add a What's New entry? -- nosy: +petr.viktorin ___ Python tracker ___

[issue42222] Modernize integer test/conversion in randrange()

2021-10-19 Thread Łukasz Langa
Change by Łukasz Langa : -- versions: +Python 3.11 -Python 3.10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42222] Modernize integer test/conversion in randrange()

2021-10-19 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 574241632bd19e56ed488ee4d8999aefc6a8d7cd by Serhiy Storchaka in branch 'main': bpo-4: Improve tests for invalid argument types in randrange() (GH-29021) https://github.com/python/cpython/commit/574241632bd19e56ed488ee4d8999aefc6a8d7cd ---

[issue42222] Modernize integer test/conversion in randrange()

2021-10-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +27294 pull_request: https://github.com/python/cpython/pull/29021 ___ Python tracker ___

[issue42222] Modernize integer test/conversion in randrange()

2021-10-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 5afa0a411243210a30526c7459a0ccff5cb88494 by Raymond Hettinger in branch 'main': bpo-4: Remove deprecated support for non-integer values (GH-28983) https://github.com/python/cpython/commit/5afa0a411243210a30526c7459a0ccff5cb88494 ---

[issue42222] Modernize integer test/conversion in randrange()

2021-10-15 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +27270 pull_request: https://github.com/python/cpython/pull/28983 ___ Python tracker ___ ___

[issue42222] Modernize integer test/conversion in randrange()

2020-12-28 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue42222] Modernize integer test/conversion in randrange()

2020-12-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset a9621bb301dba44494e81edc00e3a3b62c96af26 by Raymond Hettinger in branch 'master': bpo-4: Modernize integer test/conversion in randrange() (#23064) https://github.com/python/cpython/commit/a9621bb301dba44494e81edc00e3a3b62c96af26 ---

[issue42222] Modernize integer test/conversion in randrange()

2020-12-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: 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 allo

[issue42222] Modernize integer test/conversion in randrange()

2020-12-24 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue42222] Modernize integer test/conversion in randrange()

2020-11-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: To put what I said another way: both items are mental paper cuts and I see benefit to both coredevs and users in getting rid of them. That is not to say 'no cost', but that there is a real benefit to be balanced against the real cost. -- _

[issue42222] Modernize integer test/conversion in randrange()

2020-11-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: To me, ValueError("non-integer arg 1 for randrange()") (ValueError('bad type') is a bit painful to read. We do sometime fix such bugs, when not documented, in future releases. Current the doc, "Return a randomly selected element from range(start, stop, ste

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: 10**9 isn't much harder than 10E9 ;-) -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Vedran Čačić
Vedran Čačić added the comment: Yes, the ability to write randrange(1e9) is sometimes nice. And the fact that it might give the number outside the intended range with probability 1e-17 is not really an important argument (people have bad intuitions about very small probabilities). But if we i

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: User feedback concur with making the change: https://twitter.com/raymondh/status/1322607969754775552 -- ___ Python tracker ___ _

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think and always thought that integer domain functions should not accept non-integer arguments even with integer value. This is why I submitted numerous patches for deprecating and finally removing support of non-integer arguments in most of integer doma

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: > These propositions were rejected by you. > Have you reconsidered your decision? I was reluctant to break any existing code. Now, I'm unsure and am inclined to harmonize it with range(). What do you think? Should we have ever supported float arguments fo

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It changes the behavior. Currently randrange(10.0) works, but with PR 23064 it would fail. See issue40046 with a ready PR for increasing coverage for the random module. If it would accepted, some tests would fail with PR 23064. If you want to deprecate ac

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: I had forgotten. It looks like float arguments were allowed: >>> randrange(10.0, 20.0, 2.0) 16 Is this worth going through a deprecation cycle to get the code cleaned-up or should we live with it as is? -- ___

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: And, if we were willing to correct the exception type from ValueError to TypeError, the code could be made simpler, faster, and more in line with user expectations. -- ___ Python tracker

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +21983 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23064 ___ Python tracker __

[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger
New submission from Raymond Hettinger : Move the int(x)==x test and conversion into the C code for operator.index(). -- components: Library (Lib) messages: 380082 nosy: rhettinger, serhiy.storchaka, tim.peters priority: normal severity: normal status: open title: Modernize integer test/