I wanted to try and replace python's mutable datastructures with immutable ones (similar to clojure).
Subclassing the builtin list class works and you can override __builtin__.list
but I haven't found any way of changing what builtin syntax refers to
__builtin__.list = ImmutableListClass
my_list = [1, 2, 3]
print type(my_list)
>>> <type 'list'>
Is there any way to change this behavior or is it hardcoded in the interpreter?
Disclaimer: I'm aware this should never be done in a serious project and it's purely for my own entertainment.