Serhiy Storchaka <[email protected]> added the comment:
I tried to make repr of floats producing a string which rounds up with eval()
(see PR 19593).
>>> complex(0.0, 1.0)
1j
>>> complex(0.0, -1.0)
(0-1j)
>>> complex(-0.0, 1.0)
-(0-1j)
>>> complex(-0.0, -1.0)
(-0.0-1j)
>>> complex(1.0, 0.0)
(1+0j)
>>> complex(-1.0, 0.0)
(-1+0j)
>>> complex(1.0, -0.0)
-(-1+0j)
>>> complex(-1.0, -0.0)
-(1+0j)
The largest problem is with complex(-0.0, 0.0) and complex(-0.0, 0.0). The only
forms which evaluate to these numbers are:
>>> complex(-0.0, 0.0)
(-0.0-0j)
>>> complex(0.0, -0.0)
-(-0.0-0j)
But it conflicts with the constructor:
>>> complex('(-0.0-0j)')
-(0+0j)
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40269>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com