Superbird11/ranges

RangeDict unexpected item membership behavior

Closed this issue · 1 comments

The last statement value is unexpected

>>> from ranges import RangeDict, Range
>>> rd = RangeDict()
>>> rd[Range(0,5)] = 'zero to five'
>>> Range(0,5) in rd
True
>>> Range(0,4) in rd
True
>>> Range(1,4) in rd
True
>>> Range(1,5) in rd
False

Using Python 3.8.1 on Windows. ranges version 0.1.3.

The bounds-checking function for Range was not using any special behavior if the other argument was also a Range, and so wasn't caring. This is kind of an edge case, but going along with the change suggested in issue #7, it makes sense.