Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: '<' not supported between instances of 'Interval' and 'Interval' #55

Open
zhongyongbin1 opened this issue May 21, 2021 · 1 comment

Comments

@zhongyongbin1
Copy link

When I follow the example and use as follows:

from interval import Interval, IntervalSet
data = [(2, 4), (9, 13), (6, 12)]

intervals = IntervalSet([Interval.between(min, max) for min, max in data])
print ([(i.lower_bound, i.upper_bound) for i in intervals])

But it reported an error, and I haven’t found a solution to a similar problem for a long time:

Traceback (most recent call last):
  File "/Users/zhongyongbin/Desktop/sapm/change-server/code/utils/handle_database/test_intercept.py", line 13, in <module>
    intervals = IntervalSet([Interval(min, max) for min, max in data])
  File "/usr/local/lib/python3.9/site-packages/interval.py", line 2065, in __init__
    BaseIntervalSet.__init__(self, items)
  File "/usr/local/lib/python3.9/site-packages/interval.py", line 922, in __init__
    self._add(i)
  File "/usr/local/lib/python3.9/site-packages/interval.py", line 1935, in _add
    self.intervals.sort()
TypeError: '<' not supported between instances of 'Interval' and 'Interval'

use python 3.9

@sunxiuqiang
Copy link

This error will be soved if you use interval3 package instead of interval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants