[Python-Dev] Coercion and comparison of numbers (original) (raw)

Neil Schemenauer nas@python.ca
Tue, 1 May 2001 17:42:15 -0700


[MAL]

I just received a bug report for mx.Number which revealed a probelm with the comparison code in Python 2.1. Looking at the code it seems that one of my original coercion patches did not make it into the core. I added a new API PyNumberCompare() knows about the new coercion mechanism and should be called for numbers instead of trying coercion in PyObjectCompare().

I remember the API. I don't remember what happened to it. Guido might have dropped it or I might have taken it out thinking the comparison issues would be sorted out by Guido.

Why is a new API needed? Why can't PyObject_Compare() do the right thing (ie. not coerce new style numbers)?

Neil