Dict equality with composite type value

It doesn’t. Forget about memory locations, they are very misleading in understanding ===.

The best definition is in its docstring:

Determine whether x and y are identical, in the sense that no program could distinguish them.

Also, if you end up defining an == method for something, it is usually advantageous to define Base.hash too right away. It is very easy to end up with your values in a Dict or something similar, and then chase a silly bug for hours just because hash does not match ==.

2 Likes