[Python-Dev] python 3.0, tp_compare not used for == test? (original) (raw)
Terry Reedy tjreedy at udel.edu
Mon Feb 2 07:53:56 CET 2009
- Previous message: [Python-Dev] python 3.0, tp_compare not used for == test?
- Next message: [Python-Dev] python 3.0, tp_compare not used for == test?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 pyrnastructType's would run tpcompare
But with python 3.0, "a==b" will always be false and tpcompare function would not even run. The only way to get it to run the tpcompare 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.
- Previous message: [Python-Dev] python 3.0, tp_compare not used for == test?
- Next message: [Python-Dev] python 3.0, tp_compare not used for == test?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]