[Python-Dev] Mixing float and Decimal -- thread reboot

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 25 01:32:49 CET 2010


Raymond Hettinger wrote:

> Conceptually, it's a bug.  The numeric tower treats non-complex
> numbers as special cases of complex where the imaginary
> component is zero (that's why the non-complex types all support
> real/imag), and since complex numbers are not allowed to compare
> to themselves, they shouldn't compare to anything else either.

There's a contradiction in there somewhere. If you believe
that a non-complex is equivalent to a complex with zero
imaginary part, then you *should* be able to compare two
complexes provided that their imaginary parts are both
zero.

(I don't think that should be the case, BTW -- complex
numbers live on a two-dimensional plane, and from a
geometrical point of view there's no reason to single
out the x-axis and give it special treatment.)

-- 
Greg



More information about the Python-Dev mailing list