Message366278
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. |
|
Date |
User |
Action |
Args |
2020-04-13 00:38:23 | josh.r | set | recipients:
+ josh.r, rushilu |
2020-04-13 00:38:23 | josh.r | set | messageid: <1586738303.39.0.454315062627.issue40269@roundup.psfhosted.org> |
2020-04-13 00:38:23 | josh.r | link | issue40269 messages |
2020-04-13 00:38:23 | josh.r | create | |
|