[issue9855] Complex number slicing neither works nor causes an error on immediate use

Eric Smith report at bugs.python.org
Tue Sep 14 18:58:08 CEST 2010


Eric Smith <eric at trueblade.com> added the comment:

The precedence doesn't work the way you think it does. Your example with the intermediate variable is the same as:

>>> ((0+1j)*(0+1j)).imag
0.0
>>> ((0+1j)*(0+1j)).real
-1.0

Note the extra level of parens so that .imag and .real are applied to the result of the multiplication.

----------
nosy: +eric.smith
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

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


More information about the Python-bugs-list mailing list