Campbell Barton wrote:
Hi, I have been writing a new C api that can build with both python 2.6 and 3.0

Questions about using current releases should be directed to the python-list (or comp.lang.python or gmane.comp.python.general), not python-dev, which is for development of future releases.

I found that when building with python 2.6, doing "a==b" between 2
different pyrna_struct_Type's would run tp_compare

But with python 3.0, "a==b" will always be false and tp_compare
function would not even run.
The only way to get it to run the tp_compare function was to do
"cmp(a, b)" however Id like to be able to use == still.

In 3.0, the build-in cmp() should have been removed and will be for 3.0.1. Do not use it. I believe the tp_compare slot should not be used either. It will become reserved. It will not be removed only because that would change the binary layout.

So use rich comparisons.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to