[Python-Dev] Re: redefining is

Casey Duncan casey at zope.com
Fri Mar 19 13:41:51 EST 2004


On Fri, 19 Mar 2004 13:28:39 -0500
"Andrew Koenig" <ark-mlist at att.net> wrote:
[..]
> > Seems to me as if there are no more than TWO meanings for any given
> > type of object, and that we provide two comparison operators in each
> > case. So what's missing?
> 
> Consider a slight variation on the example above:
> 
> 	a = []
> 	b = []
> 	x1 = (a, b)
> 	y1 = (a, b)
> 
> Now: x1 and y1 are mutually substitutable; x and y are equal but not
> mutually substitutable, and x, y, x1, and y1 are all distinct objects.
> 
> So I think there are three kinds of comparison, not just two.

So let's see if I can rephrase this:

Objects are equivilant if they are the same type and their states are
the same

Objects are interchangable if they are equivilant and their states will
always be the same (i.e., changes to one are always reflected in the
other) or if they are equivilant and immutable.

Objects are identical if they are physically the same (in the sense of
'is' currently)

There is also a fourth type:

Objects are equal if ob1.__eq__(ob2) returns true.

-Casey





More information about the Python-Dev mailing list