Make the Environment to impelement the dict interface
Make the Environment object a subclass of UserDict so all methods of dict.* (get, pop, copy, ...) could by used.
The old self.__store
is now available under self.data
.
If necessary, some methods, e.g., __del__
could be forbidden with the following idiom:
class Environment(UserDict):
# ...
def __del__(self):
raise RuntimeError("Deletion not allowed")
What do you think?