from types import MappingProxyType d = {} d["a"] = 1 d["b"] = 2 print(d) frozen = MappingProxyType(d) print(frozen["a"]) # Error: frozen["b"] = "new"
Only if you deny access to the underlying real dict.
Only if you deny access to the underlying real dict.