Looking into Queue.py in Python 2.6, I found this construct that I found a bit strange:
def full(self):
\"\"\"Return True if the queue is full, False oth
Here it is, in all its glory.
>>> class showme(object):
... def __init__(self, name, value):
... self.name, self.value = name, value
... def __repr__(self):
... return "" % (self.name, self.value)
... def __cmp__(self, other):
... print "cmp(%r, %r)" % (self, other)
... if type(other) == showme:
... return cmp(self.value, other.value)
... else:
... return cmp(self.value, other)
...
>>> showme(1,0) < showme(2,0) == showme(3,0)
cmp(, )
False
>>> (showme(1,0) < showme(2,0)) == showme(3,0)
cmp(, )
cmp(, False)
True
>>> showme(1,0) < (showme(2,0) == showme(3,0))
cmp(, )
cmp(, True)
True
>>>