1 # Copyright 2014 Donald Stufft
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from __future__ import absolute_import, division, print_function
17 class Infinity(object):
23 return hash(repr(self))
25 def __lt__(self, other):
28 def __le__(self, other):
31 def __eq__(self, other):
32 return isinstance(other, self.__class__)
34 def __ne__(self, other):
35 return not isinstance(other, self.__class__)
37 def __gt__(self, other):
40 def __ge__(self, other):
44 return NegativeInfinity
49 class NegativeInfinity(object):
55 return hash(repr(self))
57 def __lt__(self, other):
60 def __le__(self, other):
63 def __eq__(self, other):
64 return isinstance(other, self.__class__)
66 def __ne__(self, other):
67 return not isinstance(other, self.__class__)
69 def __gt__(self, other):
72 def __ge__(self, other):
78 NegativeInfinity = NegativeInfinity()