You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a lot of methods will check bit ranges and throw exceptions for out of range positions.
Basically I'm thinking of anything that uses the _validate_slice method.
Standard slice checking doesn't do this - if an index is out of range it gets clipped to the extreme instead. By using this behaviour we can simplify some code and perhaps also be more Pythonic.
It's a breaking change, but not hugely so - some exceptions wouldn't be raised.
Validating a slice could then be done with just this:
i = slice(start, end, None).indices(len(self))
return i[0], i[1]
The text was updated successfully, but these errors were encountered:
Currently a lot of methods will check bit ranges and throw exceptions for out of range positions.
Basically I'm thinking of anything that uses the
_validate_slice
method.Standard slice checking doesn't do this - if an index is out of range it gets clipped to the extreme instead. By using this behaviour we can simplify some code and perhaps also be more Pythonic.
It's a breaking change, but not hugely so - some exceptions wouldn't be raised.
Validating a slice could then be done with just this:
The text was updated successfully, but these errors were encountered: