make util.Date and util.Time lt robust with other types

This commit is contained in:
Adam Holmberg
2016-07-22 16:30:02 -05:00
parent 1116a6943f
commit 250a134355

View File

@@ -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):