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/122311.html below:

[Python-Dev] return type of __complex__

[Python-Dev] return type of __complex__ [Python-Dev] return type of __complex__Terry Reedy tjreedy at udel.edu
Sun Oct 21 17:36:45 CEST 2012
On 10/21/2012 8:23 AM, Stephen J. Turnbull wrote:
> Greg Ewing writes:
>   > Stephen J. Turnbull wrote:
>   > > It's a design bug, yes.  The question is, does it conform to
>   > > documented behavior?
>   >
>   > The 2.7 docs say this about __complex__:
>   >
>   >     Called to implement the built-in function complex() ...
>   >     Should return a value of the appropriate type.

I would take that as meaning complex or subclass thereof or whatever is 
consistent with float() and int().

>   >
>   > So the question is whether float is an "appropriate type" when
>   > you're expecting a complex.
>
> I probably not say that, but even so my personal taste would be to fix
> the docs to describe the current behavior in 2.7.  Evidently somebody
> thought "float" was appropriate, or they would have just written
> "Returns a complex value."  Stability is more important than catering
> to my taste (even if it happens to represent a majority in some sense).
>


-- 
Terry Jan Reedy

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