Superbird11 / ranges

Continuous Range, RangeSet, and RangeDict data structures for Python
MIT License
101 stars 10 forks source link

Implement __invert__ for Rangelike classes #18

Closed jefflongo closed 2 years ago

jefflongo commented 2 years ago

__or__, __and__, __xor__ are implemented to do intersection, union, symmetric_difference respectively. It feels only natural that __invert__ should be implemented to call complement.

Example expected usage:

>>> r = Range(1, 3)
>>> ~x
RangeSet{Range[-inf, 1), Range[3, inf)}