A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2014-July/135404.html below:

[Python-Dev] == on object tests identity in 3.x

[Python-Dev] == on object tests identity in 3.xAntoine Pitrou antoine at python.org
Wed Jul 9 15:21:26 CEST 2014
Le 09/07/2014 00:21, Stephen J. Turnbull a écrit :
> Steven D'Aprano writes:
>
>   > I don't think so. Floating point == represents *numeric* equality,
>
> There is no such thing as floating point == in Python.  You can apply
> == to two floating point numbers, but == (at the language level)
> handles any two numbers, as well as pairs of things that aren't
> numbers in the Python language.

This is becoming pointless hair-splitting.

 >>> float.__eq__(1.0, 2.0)
False
 >>> float.__eq__(1.0, 2)
False
 >>> float.__eq__(1.0, 1.0+0J)
NotImplemented
 >>> float.__eq__(1, 2)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: descriptor '__eq__' requires a 'float' object but received a 
'int'


Please direct any further discussion of this to python-ideas.


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