[issue22683] bisect index out of bounds issue

2014-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: > treat the hi in the precondition in the same way as the lo parameter Originally, there was no special test for lo. The test was added only because negative lo value failed in an unfortunate way (with an infinite loop). No change to hi was made because (

[issue22683] bisect index out of bounds issue

2014-10-22 Thread Paul Ianas
Paul Ianas added the comment: Sure, it is your call. As said, this is rather an enhancement. Still, if I were to decide, I would chose: 1. not to break the API <=> raise IndexError instead of ValueError in case hi is invalid. 2. to protect against illegal values: as said, if hi < 0 bisect_* alw

[issue22683] bisect index out of bounds issue

2014-10-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: These functions are very old and the API is unlikely to change, particularly if the goal is to change one kind of exception to another (making bad inputs fail in a different way than they do now). As far as I can tell, the current arrangement has never bee

[issue22683] bisect index out of bounds issue

2014-10-22 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue22683] bisect index out of bounds issue

2014-10-21 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +rhettinger, tim.peters ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue22683] bisect index out of bounds issue

2014-10-21 Thread Paul Ianas
New submission from Paul Ianas: The precondition for all the bisect functions is implemented like this: if lo < 0: raise ValueError('lo must be non-negative') if hi is None: hi = len(a) Now, of course, if hi is given, and hi >= 2 * len(a), then we get an IndexError. In