Am 2014-07-08 02:22, schrieb Ethan Furman:
On 07/07/2014 05:12 PM, Andreas Maier wrote:
Am 2014-07-07 18:09, schrieb Ethan Furman:

Just because two instances from the same object have the same value does not mean they are equal. For a real-life
example, look at twins:  biologically identical, yet not equal.

I think they *are* equal in Python if they have the same value, by definition, because somewhere the Python docs state
that equality compares the object's values.

And is personality of no value, then?

I guess you are pulling my leg, Ethan ... ;-)

But again, for a definition of equality between instances of a Python class representing twins, one has to decide what attributes of the twins are supposed to be part of that. If the designer of the class decides that just the biology atributes are part of equality, fine. If he or she decides that personality attributes are additionally part of equality, also fine.

The reality though is that value is more vague than equality test (as it was already pointed out in this thread): A class designer can directly implement what equality means to the class, but he or she cannot implement an accessor method for the value. The value plays a role only indirectly as part of equality and ordering tests.

Not sure what you mean by this.

Equality has a precise implementation (and hence definition) in Python; value does not. So to argue that value and equality can be different, is moot in a way, because it is not clear in Python what the value of an object is.

Andy

_______________________________________________
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