Python 101 : Immutability of a Tuple.



tuple is a group of references to different items. These references or locations in memory are immutable, but the items these references point to could be mutable lists - or immutable strings -.



Sometimes the mutable elements in a tuple could create hard-to-find errors. 
We could use a hash function to check the "complete" immutability of a tuple as below:


Regarding the output, we get:
False : because "t1" contains a mutable item - list -.

Comments

Leave as a comment:

Archive