> Is "mutually substitutable" a fancy way of saying "equal"? In other > words, > why would "x is y" be preferred over "x == y"? "Mutually substitutable" is a fancy way of saying "equal" for immutable objects only. For mutable objects, or for immutable objects with mutable components, the situation is more complicated. For example: a = [] b = [] x = (a, a) y = (b, b) Here, x and y are equal but not mutably substitutable, because if I execute x[0].append(42), it changes x but not y. On the other hand, if a and b were () rather than [], then x and y would be mutually substitutable because there would be no way to distinguish x from y except by their id.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4