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
I.closed(datetime.date(2020,10,18),I.inf) & I.closed(datetime.date(2020,11,29),I.inf)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/intervals.py", line 101, in closed
return Interval(AtomicInterval(CLOSED, lower, upper, CLOSED))
File "/usr/lib/python2.7/site-packages/intervals.py", line 382, in init
if self.is_empty():
File "/usr/lib/python2.7/site-packages/intervals.py", line 423, in is_empty
self._lower > self._upper or
TypeError: can't compare datetime.date to instance
The text was updated successfully, but these errors were encountered:
That's because datetime does not return NotImplemented in Python 2.7 when compared with unsupported values, so we cannot intercept comparison operators and override their behaviour with infinities.
This issue is related to #5 and cannot be solved for Python 2.7. In Python 3, your snippet works, and leads to [datetime.date(2020, 11, 29),+inf).
Thanks for your response, If possible can you share workaround if you have. Otherwise i will plan to use python3 itself.
This module is very helpful to get the interval information.
Unfortunately, there is no easy workaround for this. I strongly recommends switching to Python 3, notably because Python 2.7 is no longer officially supported since January 2020, but also because it is not supported by portion and you're likely to have other issues.
The text was updated successfully, but these errors were encountered: