A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-October/122243.html below:

[Python-Dev] return type of __complex__

[Python-Dev] return type of __complex__ [Python-Dev] return type of __complex__Nick Coghlan ncoghlan at gmail.com
Fri Oct 19 16:13:51 CEST 2012
On Fri, Oct 19, 2012 at 11:08 PM, Antonio Cuni <anto.cuni at gmail.com> 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

More importantly, relaxing the checks in cmath is backwards
compatible. while tightening up the checks in complex_new is not.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4