On 11/2/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> > Should the default equality operator compare valuesinstead of
> identities?
>
> No.  Look back into last year's python-dev postings where we agreed that
> identity would always imply equality.  There were a number of practical
> reasons.  Also, there are a number of places in CPython where that
> assumption is implicit.
>
Perhaps you've meant something else, or I didn't understand? Identity
implying equality is true also in value-based comparison. If the
default __eq__ operator compares by value, I would say that it would
do something like:

def __eq__(self, other):
    if self is other:
        return True
    if type(self) is not type(other):
        return False
    (compare the __dict__ and any __slots__, and if they are all ==,
return True.)

Noam
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to