On 10/10/2013 16:57, Rotwang wrote:
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
Indeed.
If r is real (float) and c is complex:
r == c means r == c.real and c.imag == 0.0
--
https://mail.python.org/mailman/listinfo/python-list