tp_richcompare vs tp_compare

  • Thread starter moerchendiser2k3
  • Start date
M

moerchendiser2k3

Hi all,

just another question. Can anyone explain me whats the real difference
between tp_richcompare and tp_compare? I read some stuff, but
sometimes I believe the author doesnt know either whats the real
difference or they forget it to explain. The Function definition looks
very similiar, except the one accepts POD types as return value, the
other wants the same for PyObjects.

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? :)

Really thanks in advance for your help!!


Bye, moerchendiser2k3
 
A

Aahz

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,172
Messages
2,570,933
Members
47,472
Latest member
blackwatermelon

Latest Threads

Top