On 28 April 2010 09:51, Stefan Behnel <[email protected]> wrote: > Lisandro Dalcin, 28.04.2010 01:21: >> diff -r 3adaf1ef25b9 Cython/Compiler/TypeSlots.py >> --- a/Cython/Compiler/TypeSlots.py Tue Apr 27 21:36:49 2010 +0200 >> +++ b/Cython/Compiler/TypeSlots.py Tue Apr 27 20:14:34 2010 -0300 >> @@ -637,7 +637,7 @@ >> EmptySlot("tp_print"), #MethodSlot(printfunc, "tp_print", "__print__"), >> EmptySlot("tp_getattr"), >> EmptySlot("tp_setattr"), >> - MethodSlot(cmpfunc, "tp_compare", "__cmp__"), >> + MethodSlot(cmpfunc, "tp_compare", "__cmp__", py3k = '<RESERVED>'), >> MethodSlot(reprfunc, "tp_repr", "__repr__"), >> >> SuiteSlot(PyNumberMethods, "PyNumberMethods", "tp_as_number"), >> >> BTW, Should I push this? > > Absolutely. >
I went further and added support for __bool__ . http://hg.cython.org/cython-devel/rev/07dd946da241 From all that patch that has some cleanup, the important bits are this ones: http://hg.cython.org/cython-devel/rev/07dd946da241#l2.80 (class MethodSlot) http://hg.cython.org/cython-devel/rev/07dd946da241#l2.175 (__nonzero__/__bool__) http://hg.cython.org/cython-devel/rev/07dd946da241#l2.223 (__cmp__) >> We could try to synthesize __richcmp__ from __cmp__ > > We shouldn't. __richcmp__ is the right thing to implement. OK, you are definitely right. > If we consider > emulating it from something, that would be the eq/lt/gt/... special methods. > Even more taking into account that in many cases all you actually what is __eq__ and __neq__ -- Lisandro Dalcin --------------- CIMEC (INTEC/CONICET-UNL) Predio CONICET-Santa Fe Colectora RN 168 Km 472, Paraje El Pozo Tel: +54-342-4511594 (ext 1011) Tel/Fax: +54-342-4511169 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
