When comparing a tuple with a list like …
>>> [1,2,3] == (1,2,3)
False
>>> [1,2,3].__eq__((1,2,3))
NotImplemented
>>> (1,2,3).__eq__([1,2,3])
NotImplemented
… Python does not deep-compare them as done with (1,2,3) == (1,2,3).
So what is the reason for this? Is it because the mutable list can be changed at any time (thread-safety issues) or what?
(I know where this is implemented in CPython, so please don’t answer where, but why it is implemented.)
You can always “cast” it
Keep in mind that Python, unlike for example Javascript, is strongly typed, and some (most?) of us prefer it that way.