[issue9011] ast_for_factor unary minus optimization changes AST

Mark Dickinson report at bugs.python.org
Thu Oct 18 14:04:01 CEST 2012


Mark Dickinson added the comment:

No, that's expected behaviour.

1j is complex(0.0, 1.0)
-1j is complex(-0.0, -1.0)

so -1j.real is -0.0.  There's not really any other sensible way to handle this.

The complex-from-string constructor, on the other hand, is more careful about interpreting signs.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9011>
_______________________________________


More information about the Python-bugs-list mailing list