[issue16290] PyComplex_AsCComplex should allow __complex__ to return float.

Mark Dickinson report at bugs.python.org
Sat Oct 20 15:17:44 CEST 2012


Mark Dickinson added the comment:

> This means that you should add a branch for integers too.

I'd rather not go that far, at least in this issue:  we'd also end up changing __float__ to allow it to return an int, in that case.  If we're considering that, the discussion should go back to python-dev / python-ideas.

One difference is that int -> float is a lossy conversion that has to care about details like rounding and overflow.  float -> complex in contrast is much simpler.

----------

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


More information about the Python-bugs-list mailing list