[issue22683] bisect index out of bounds issue

Paul Ianas report at bugs.python.org
Thu Oct 23 08:52:37 CEST 2014


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_* always returns 0 (whatever the searched value).
3. I would implement a single _range_check(_len, lo, hi) method to do this logic (DRY).

That being said, from my point of view this ticket can be closed.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22683>
_______________________________________


More information about the Python-bugs-list mailing list