This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Dynamic(dict): | |
| """Dynamic objects are just bags of properties, some of which may happen to be functions""" | |
| def __init__(self, **kwargs): | |
| self.__dict__ = self | |
| self.update(kwargs) | |
| def __setattr__(self, name, value): | |
| import types | |
| if isinstance(value, types.FunctionType): | |
| self[name] = types.MethodType(value, self) |
NewerOlder