Okay, that's fair. So the argument really comes down to backwards compatibility (which is inconvenient but important).

On Sat, May 2, 2020 at 1:51 PM Dominik Vilsmeier <dominik.vilsmeier@gmx.de> wrote:

`frozenset` and `set` make a counterexample:

>>> frozenset({1}) == {1}
True

On 02.05.20 22:36, Guido van Rossum wrote:
It does look like that would violate a basic property of `==` -- if two values compare equal, they should be equally usable as dict keys. I can't think of any counterexamples.

On Sat, May 2, 2020 at 1:33 PM Alex Hall <alex.mojaki@gmail.com> wrote:
On Sat, May 2, 2020 at 9:51 PM Serhiy Storchaka <storchaka@gmail.com> wrote:
02.05.20 21:34, Ahmed Amr пише:
> I see there are ways to compare them item-wise, I'm suggesting to bake
> that functionality inside the core implementation of such indexed
> structures.
> Also those solutions are direct with tuples and lists, but it wouldn't
> be as direct with arrays-lists/tuples comparisons for example.

If make `(1, 2, 3) == [1, 2, 3]` we would need to make `hash((1, 2, 3))
== hash([1, 2, 3])`.

Would we? Is the contract `x == y => hash(x) == hash(y)` still required if hash(y) is an error? What situation involving dicts could lead to a bug if `(1, 2, 3) == [1, 2, 3]` but `hash((1, 2, 3))` is defined and `hash([1, 2, 3])` isn't?

The closest example I can think of is that you might think you can do `{(1, 2, 3): 4}[[1, 2, 3]]`, but once you get `TypeError: unhashable type: 'list'` it'd be easy to fix.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/BMSP5BQP2UURBKV5LPLQXO6PZDP5PQGX/
Code of Conduct: http://python.org/psf/codeofconduct/


--
--Guido van Rossum (python.org/~guido)

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OPT6D6COYSMATTARQTUVVMAOPP6LEGHN/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/KMKPS3XCES5T5J4TY2PX3UQ7XPWE5AOB/
Code of Conduct: http://python.org/psf/codeofconduct/


--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him (why is my pronoun here?)