[Python-Dev] == on object tests identity in 3.x (original) (raw)

Ethan Furman ethan at stoneleaf.us
Fri Jul 11 22:54:40 CEST 2014


On 07/11/2014 07:04 AM, Andreas Maier wrote:

Am 09.07.2014 03:48, schrieb Raymond Hettinger:

Personally, I see no need to make the same mistake by removing the identity-implies-equality rule from the built-in containers. There's no need to upset the apple cart for nearly zero benefit. Containers delegate the equal comparison on the container to their elements; they do not apply identity-based comparison to their elements. At least that is the externally visible behavior.

If that were true, then [NaN] == [NaN] would be False, and it is not.

Here is the externally visible behavior:

Python 3.5.0a0 (default:34881ee3eec5, Jun 16 2014, 11:31:20) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. --> NaN = float('nan') --> NaN == NaN False --> [NaN] == [NaN] True

-- Ethan



More information about the Python-Dev mailing list