On Thu, May 7, 2020 at 2:33 AM Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
On Sat, 2 May 2020 at 20:50, 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])`.

This is the key point. Much of the other discussion in this thread
seems to be bogged down in the mathematical interpretation of tuples
and sequences but if I was to take something from maths here it would
be the substitution principle of equality:
https://en.wikipedia.org/wiki/Equality_(mathematics)#Basic_properties

What the substitution principle essentially says is
   if x == y then f(x) == f(y)
for any function f such that f(x) is well defined.

What that means is that I should be able to substitute x for y in any
context where x would work without any change of behaviour.

We discussed this and Dominik pointed out that set and frozenset already break this property, specifically for hash(). Do you think frozensets and normal sets should never be equal?