-----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 tsea...@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----- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com