On Fri, Jan 24, 2020 at 3:45 AM Steven D'Aprano <st...@pearwood.info> wrote:

> On Fri, Jan 24, 2020 at 12:36:13PM +0300, Ivan Pozdeev via Python-Dev
> wrote:
>
> > >I'm tempted to declare this implementation-defined behavior --
> *implicit*
> > >calls to __eq__ and __ne__ *may* be skipped if both sides are the same
> > >object depending on the whim of the implementation.
> >
> > This cannot be an implementation detail because it changes the outcome
> of
> > operations.
>
> Guido didn't call it an implementation *detail* but implementation-
> defined behaviour. And of course that implies that the outcome could be
> different when using different implementations.
>
> I'm pretty sure Guido understood the implication when he made that
> comment.
>

Yes I did.

The only thing I'm unsure of here is whether direct use of the `==` and
> `!=` operators are included as "implicit calls" to the dunders. I
> *think* I understand Guido's intention, but I'm not sure:
>
> * x == y MUST call `__eq__`
>
> * likewise x != y MUST call `__ne__`
>
> * but compound objects such as lists and other collections MAY skip
>   calling `__eq__` (or `__eq__`) on their component parts.
>

Right.

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/ROGSIA25KPMPSX6KVZDV5TA76IYT2WFL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to