make util.Date and util.Time lt robust with other types
This commit is contained in:
@@ -973,6 +973,8 @@ class Time(object):
|
||||
microsecond=self.nanosecond // Time.MICRO) == other
|
||||
|
||||
def __lt__(self, other):
|
||||
if not isinstance(other, Time):
|
||||
return NotImplemented
|
||||
return self.nanosecond_time < other.nanosecond_time
|
||||
|
||||
def __repr__(self):
|
||||
@@ -1061,6 +1063,8 @@ class Date(object):
|
||||
return False
|
||||
|
||||
def __lt__(self, other):
|
||||
if not isinstance(other, Date):
|
||||
return NotImplemented
|
||||
return self.days_from_epoch < other.days_from_epoch
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
Reference in New Issue
Block a user