On Sun, Sep 30, 2018 at 11:35 AM Chris Angelico <ros...@gmail.com> wrote:

> On Mon, Oct 1, 2018 at 1:32 AM Steve Barnes <gadgetst...@live.co.uk>
> wrote:
> > No complex can be converted to float without accessing either the real
> > or imag component.
> Or taking its absolute value, which will return nan if either part is nan.
>

Well, various other operations as well as abs().  Anything that reduces a
complex to a float already... I guess you could argue that behind the
scenest hese functions all access .real and/or .imag.

>>> float(abs(1+1j))
1.4142135623730951
>>> float(cmath.phase(1+1j))
0.7853981633974483
>>> float(cmath.isfinite(1+1j))
1.0



-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to