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 josh.r
Recipients josh.r, rushilu
Date 2020-04-13.00:38:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586738303.39.0.454315062627.issue40269@roundup.psfhosted.org>
In-reply-to
Content
The final entry is identical to the second to last, because ints have no concept of -0. If you used a float literal, it would match the first two:

>>> -0.-1j
(-0-1j)

I suspect the behavior here is due to -1j not actually being a literal on its own; it's interpreted as the negation of 1j, where 1j is actually 0.0+1.0j, and negating it flips the sign on both the real and imaginary component.

From what I can read of the grammar rules, this is expected; the negation isn't ever part of the literal (minus signs aren't part of the grammar aside from exponents in scientific notation). https://docs.python.org/3/reference/lexical_analysis.html#floating-point-literals

If this is a bug, it's a bug in the grammar. I suspect the correct solution here is to include the real part explicitly, as 0.0-1j works just fine.
History
Date User Action Args
2020-04-13 00:38:23josh.rsetrecipients: + josh.r, rushilu
2020-04-13 00:38:23josh.rsetmessageid: <1586738303.39.0.454315062627.issue40269@roundup.psfhosted.org>
2020-04-13 00:38:23josh.rlinkissue40269 messages
2020-04-13 00:38:23josh.rcreate