On Jun 17, 5:33 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Tue, 17 Jun 2008 02:25:42 -0300, Lie <[EMAIL PROTECTED]> escribió:

>
> > Basically 'a is b' and 'not(a is b)' is similar to 'id(a) == id(b)'
> > and 'not(id(a) == id(b))'
>
> No.
...
> ... The above statement is not. A counterexample:
>
> py> [] is []
> False
> py> id([])==id([])
> True
>
But that's not what he said, he used 'a' and 'b' which are names, not
anonymous objects.
Fairer would be,
a = [];b = []
id(a) == id(b)

Morevover, Lie wrote "id(a)==id(b)".  Since there is no need for the
anonymous object to persist following id testing, you cannot guarantee
that you are comparing an id of two objects (as referred to by 'a' and
'b').  Haven't you, in effect, tested id(a) == id(a)?  While this
might be an interesting effect, I doubt that it clarifies the
difference between equivalence and identity testing, in the way Lie's
statement in fact does.

Also in considering what equivalence means in python reference ought
to be made to the __eq__ method.  The original querant may care to
look it up.




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to