[issue6044] Exception message in int() when trying to convert a complex

Georg Brandl report at bugs.python.org
Sun May 17 11:21:07 CEST 2009


Georg Brandl <georg at python.org> added the comment:

That no unambiguous conversion between complex and int is defined is
exactly the reason for this error message.  You could want the absolute
value, the real part, the imaginary part, or even the polar angle...

int(abs(z)) works as intended, giving you the absolute value of the
complex number, which is 1 for 1j**2.

----------
nosy: +georg.brandl
resolution:  -> invalid
status: open -> closed

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


More information about the Python-bugs-list mailing list