From dd813a3548fe7d2608093e57981365a62b6d3af6 Mon Sep 17 00:00:00 2001 From: ajul Date: Wed, 24 Jan 2018 16:17:34 -0500 Subject: [PATCH] implement all comparators for time --- pyradox/primitive.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyradox/primitive.py b/pyradox/primitive.py index 4b7301c..7be4f84 100644 --- a/pyradox/primitive.py +++ b/pyradox/primitive.py @@ -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