[Python-3000] Need closure on __cmp__ removal

Christian Heimes lists at cheimes.de
Wed Jan 9 01:49:44 CET 2008

Guido van Rossum wrote:
> That's a different issue altogether (and your wish is not likely going
> to be granted unless you write a PEP).

You could write and implement a PEP about exposing the tp_richcompare
slot to Python code.

import sys

class Example:
    def __richcmp__(self, other: object, op: int) -> bool:
        if op == sys.CMP_EQ:
            return self.value == other.value


More information about the Python-3000 mailing list