⬅︎ Back to When to __deepcopy__ classes in Python
Thanks! I like that. This is why I keep blogging and expose my weaknesses because people like you come in and nudge me in the right direction.
How about not breaking all the magic methods in the first place? class Foo(dict): ····def __getattr__(self, attr): ········if attr.startswith('__'): ············raise AttributeError(attr) ········return self[attr]
Comment
Thanks! I like that.
This is why I keep blogging and expose my weaknesses because people like you come in and nudge me in the right direction.
Parent comment
How about not breaking all the magic methods in the first place? class Foo(dict): ····def __getattr__(self, attr): ········if attr.startswith('__'): ············raise AttributeError(attr) ········return self[attr]