On Fri, Jan 24, 2020 at 5:24 PM Victor Stinner <[email protected]> wrote:
>
> You're right that it's not only about list.count().
>
> list.count(), list.index(), tuple.count() and tuple.index() all
> consider that two elements are equal if id(x) == id(y):
>

FWIW, (list|tuple).__eq__ and (list|tuple).__contains__ uses it too.
It is very important to compare recursive sequences.

>>> x = []
>>> x.append(x)
>>> y = [x]
>>> z = [x]
>>> y == z
True

-- 
Inada Naoki  <[email protected]>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/ILPWRGJOB4AFECGQHOH5LIZ7HPMACXX7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to