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

[Python-Dev] return type of __complex__

[Python-Dev] return type of __complex__ [Python-Dev] return type of __complex__Tres Seaver tseaver at palladion.com
Sat Oct 20 21:28:28 CEST 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/19/2012 07:35 PM, Greg Ewing wrote:
> Antonio Cuni wrote:
>> Traceback (most recent call last): File "<stdin>", line 1, in
>> <module> TypeError: __complex__ should return a complex object
>> 
>> i.e., the complex constructor does not check that __complex__
>> returns an actual complex, while the cmath functions do.
> 
> Looks to me like cmath is being excessively finicky here. Why
> shouldn't a float be usable in *any* context expecting a complex?

Exactly:  float is perfectly Liskov-substituable for complex;  only
applications which do explicit type sniffing can tell the difference,
which makes the sniffing bogus.


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlCC+1wACgkQ+gerLs4ltQ7S1QCfUjvUsmMiHuW8DDXue0HPzvXE
Qv4Anissl8zNnx8KZyJQfcDxWlddTXGA
=6KUH
-----END PGP SIGNATURE-----

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