class ImmutableList(tuple):
A tuple-like object that raises useful errors when it is asked to mutate.
Example:
>>> a = ImmutableList(range(5), warning="You cannot mutate this.") >>> a[3] = '4' Traceback (most recent call last): ... AttributeError: You cannot mutate this.