Is 'everything' a refrence or isn't it?

Paul Rubin http
Sat Jan 14 17:48:29 EST 2006

Mike Meyer <mwm at> writes:
> > Whether the '==' operation conforms to your idea of what equality
> > means is unclear.
> Care to say what it does mean, then?

    class boffo(int):
        def __eq__(x,y): return True

    a,b = boffo(2), boffo(3)
    print a+b, a==b, (a+2)==(b+2)

I'd say a==b doesn't necessarily mean a and b have the same value.
At minimum, if a and b have the same value, I'd expect a+2 to be
the same as b+2.  So in this case, a==b but they have differing values.

More information about the Python-list mailing list