On Fri, 24 Jan 2020 at 11:15, Terry Reedy <tjre...@udel.edu> wrote:
>
> On 1/24/2020 4:23 AM, Paul Moore wrote:
> > We could add an extra clause here: """As an optimisation, when the
> > implementation *implicitly* compares two values for equality (for
> > example, in list comparison or `list.count`) it is allowed (but not
> > required) to omit the equality check if the objects being compared are
> > the same. This can result in different behaviour for objects with
> > user-defined equality that is not reflexive - that is acceptable."""
>
> This is an expanded version of what already exists further down, under
> sequences.
>
> " The built-in containers typically assume identical objects are equal
> to themselves. That lets them bypass equality tests for identical
> objects to improve performance and to maintain their internal invariants."
>
> This was added last August, after careful consideration, by myself and
> Raymond, as a beginner friendly replacement of 17 lines, that says what
> users actually need to know.

Yes that's a lot better than my wording (no surprise, you put a lot of
thought into it whereas I dashed off a suggestion in a few minutes
:-))

I do wonder what to make of the fact that in spite of reading that
section specifically because this question was raised, I still missed
it. The whole section is information that's rarely needed in normal
use, but explains the corner cases and specifics in detail (and does
so well - the whole section is nice to read, not just the bit you
quoted). There's just a lot to say, and it's easy to miss bits as you
skim.

Maybe all we need to take from this is that it's already documented,
but there's always going to be an issue of how to ensure people can
find the details they need.

Paul
_______________________________________________
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/RM4MH6NWUB3W2STDQM3ZHCUNM3O572I5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to