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.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to