This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients docs@python, josh.r, mark.dickinson, rhettinger, rushilu, serhiy.storchaka, steven.daprano, tim.peters
Date 2020-04-19.08:26:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587284812.29.0.657528967365.issue40269@roundup.psfhosted.org>
In-reply-to
Content
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)
History
Date User Action Args
2020-04-19 08:26:52serhiy.storchakasetrecipients: + serhiy.storchaka, tim.peters, rhettinger, mark.dickinson, steven.daprano, docs@python, josh.r, rushilu
2020-04-19 08:26:52serhiy.storchakasetmessageid: <1587284812.29.0.657528967365.issue40269@roundup.psfhosted.org>
2020-04-19 08:26:52serhiy.storchakalinkissue40269 messages
2020-04-19 08:26:52serhiy.storchakacreate