Rick Johnson wrote:
> I get sick and tired of doing this!!!
>
> if maxlength == UNLIMITED:
> allow_passage()
> elif len(string) > maxlength:
> deny_passage()
>
> What Python needs is some constant that can be compared to ANY numeric
> type and that constant will ALWAYS be larger!
Easily fixed:
class Greatest (object):
def __cmp__ (self, other):
if isinstance (other, Greatest):
return 0
return 1
def __hash__ (self):
return id (Greatest)
class Least (object):
def __cmp__ (self, other):
if isinstance (other, Least):
return 0
return -1
def __hash__ (self):
return id (Least)
Mel.
--
http://mail.python.org/mailman/listinfo/python-list