On approximately 10/27/2008 10:27 AM, came the following characters from
the keyboard of Peter Otten:

Here's a class that can negate arbitrary values

...     def __init__(self, value):
...             self.value = value
...     def __cmp__(self, other):
...             return -cmp(self.value, other.value)

Unfortunately, the __cmp__ method has been eliminated from
3.0 as well, so this won't work as-is. You would need to
override __lt__, __eq__, etc.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to