I am never going to complain about Python again

Rotwang sg552 at hotmail.co.uk
Thu Oct 10 11:57:31 EDT 2013


On 10/10/2013 16:51, Neil Cerutti wrote:
> [...]
>
> Mixed arithmetic always promotes to the wider type (except in
> the case of complex numbers (Ha!)).
>
> r == c is equivalent to r == abs(c), which returns the magintude
> of the complex number.

What?

 >>> -1 == -1 + 0j
True
 >>> -1 == abs(-1 + 0j)
False
 >>> 1 == 0 + 1j
False
 >>> 1 == abs(0 + 1j)
True



More information about the Python-list mailing list