[Python-Dev] return type of __complex__

Nick Coghlan ncoghlan at gmail.com
Sat Oct 20 04:04:44 CEST 2012


On Sat, Oct 20, 2012 at 2:23 AM, Maciej Fijalkowski <fijall at gmail.com> wrote:
> On Fri, Oct 19, 2012 at 5:56 PM, Benjamin Peterson <benjamin at python.org> wrote:
>> It's a new feature. Also, it's possible that someone is relying on it
>> throwing for non-complex values.
>>
>
> Nick just said it's a bug that cmath type checks are too strict.

It wouldn't be the first time PyPy has picked up on something that is
technically a bug in CPython that we nevertheless deemed too risky to
fix in CPython maintenance releases (the other main one I'm aware of
is the fact we sometimes get the + and * operand precedence wrong for
sequence types implemented in C).

I don't see the same level of risk here that Benjamin does (it's not
like the conversion process would be *returning* a float value, just
taking the "+ 0j" as implied when handed a floating point value by
__complex__, the same way the constructor does), but it's still the
RMs call as to what's acceptable for a maintenance release.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list