Skip to content

Commit

Permalink
implement all comparators for time
Browse files Browse the repository at this point in the history
  • Loading branch information
ajul committed Jan 24, 2018
1 parent ea820cc commit dd813a3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pyradox/primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,22 @@ def __init__(self, year = None, month = None, day = None, hour = None):
def __lt__(self, other):
return self.data < other.data

def __le__(self, other):
return self.data <= other.data

def __gt__(self, other):
return self.data > other.data

def __ge__(self, other):
return self.data >= other.data

def __eq__(self, other):
if not isinstance(other, Time): return False
return self.data == other.data

def __ne__(self, other):
return not (self == other)

def __iter__(self):
for x in self.data: yield x

Expand Down

0 comments on commit dd813a3

Please sign in to comment.