[issue40832] hi param in bisect module should not accept negative values

2020-07-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: If the implementation made it easy, I would add the check. But since it would be an invasive change, I'm inclined to pass on it because it is so uncommon — the lo and hi arguments are rarely used, even more rarely with a negative hi paired with a non-nega

[issue40832] hi param in bisect module should not accept negative values

2020-05-31 Thread Vikash Raja Samuel Selvin
Vikash Raja Samuel Selvin added the comment: Thanks for your comments. Just to make sure I understood correctly, even though something like bisect.bisect_right(l, 5.1, 0, -2) [This returns 0 which is wrong] is allowed, since it is not common / intended it is ok to not check for negative val

[issue40832] hi param in bisect module should not accept negative values

2020-05-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm -0 on this one. Originally, there were no range checks at all. This kept the code small and fast which was important because bisect() is a building block sometimes used in tight loops, random.choices() for example. Later, a test for negative lo valu

[issue40832] hi param in bisect module should not accept negative values

2020-05-31 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger versions: -Python 3.7, Python 3.8, Python 3.9 ___ Python tracker ___ ___

[issue40832] hi param in bisect module should not accept negative values

2020-05-31 Thread SilentGhost
Change by SilentGhost : -- nosy: +rhettinger versions: +Python 3.10, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker ___ ___ P

[issue40832] hi param in bisect module should not accept negative values

2020-05-31 Thread Vikash Raja Samuel Selvin
New submission from Vikash Raja Samuel Selvin : >>> bisect.bisect_right(l, 5.1, -1) Traceback (most recent call last): File "", line 1, in ValueError: lo must be non-negative >>> l [0, 1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9] >>> bisect.bisect_right(l, 5.1, 0, -2) 0 In order to be consistent with