On Fri, Oct 19, 2012 at 10:13 AM, Nick Coghlan <[email protected]> wrote:
> On Fri, Oct 19, 2012 at 11:08 PM, Antonio Cuni <[email protected]> wrote:
>> Is that the real intended behavior?
>
> Given the way complex numbers interact with floats generally,
> returning a complex number with no imaginary component as a floating
> point value seems legitimate and the checks in cmath overly strict.
> Otherwise you would get redundancy like:
>
> def __complex__(self):
> return complex(value)
>
> or
>
> def __complex__(self):
> return value + 0j
No you wouldn't:
def __float__(self):
return value
-- Devin
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com