Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

The Imaginary type could help to solve other "gotchas". For example, in Python

>>> complex(0, float('inf')) * 1
(nan+infj)

But in C++ you will get the real component 0, because multiplication of complex 
and real numbers is component wise.

With the Imaginary type we could get that 1j * x == complex(0, x) for all float 
x, including infinity and NaN.

Returning to the repr, the other way to correctly represent the repr of 
complex(-0.0, 1.0) is writing it as "-(0.0-1j)", but it looks unnatural to me.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40269>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to