[Python-ideas] [Python-Dev] The Case Against Floating Point ==

Jim Jewett jimjjewett at gmail.com
Tue Mar 18 23:33:06 CET 2008

On 3/13/08, Mark Dickinson <dickinsm at gmail.com> wrote:
> On Thu, Mar 13, 2008 at 6:18 PM, Imri Goldberg <lorgandon at gmail.com> wrote:

> I really think that there's essentially zero chance of == and != ever
> changing to 'fuzzy' comparisons in Python.

They sort of already did -- you can define __eq__ and __ne__ on your
own class in bizarre and inconsistent ways.  [Though I think you can't
easily override that (x is y) ==> (x==y).]

You can even do this with your own float-alike class.

What you're really asking for is that the float class take advantage of this.

> I don't know of any other language that has successfully done this, ...

Changing an existing class requires that the class be "open".  That is
the default in languages like smalltalk or ruby.  It is even the
default for python classes -- but it is certainly not the default for
"python" classes that are actually coded in C -- which includes


More information about the Python-ideas mailing list