[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

[issue22683] bisect index out of bounds issue

2014-10-23 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_