Deep comparison of sets?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Nov 7 14:39:52 EST 2007


On Wed, 07 Nov 2007 10:22:27 -0800, Daryl Spitzer wrote:

>     def __cmp__(self, other):
>         if self.value > other.value: return 1
>         if self.value < other.value: return -1
>         return 0

This can be written a bit shorter::

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

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list