tp_richcompare vs tp_compare

Aahz aahz at pythoncraft.com
Fri Jul 2 21:30:33 EDT 2010


In article <d52edb82-4de5-496d-8807-b5d15ee66195 at i31g2000yqm.googlegroups.com>,
moerchendiser2k3  <googler.1.webmaster at spamgourmet.com> wrote:
>
>Do I need to implement both? Looks very redundant, isnt it? Or is it
>just an extension and tp_richcompare is the better choice here? Can
>anyone please make the light on here? :)

Nobody else responded, so please take this non-expert advice:

tp_compare is the older and now deprecated slot; you want to use
tp_richcompare if you don't need to support older versions of Python.
Don't implement both.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra



More information about the Python-list mailing list