3 ms·
default __slots__ breaks a lot of monkey patching. An "easier" change would be to add a class attribute "no__dict__", which says that the __dict__ attribute c
by anamax 4y ago
default __slots__ breaks a lot of monkey patching.
An "easier" change would be to add a class attribute "no__dict__", which says that the __dict__ attribute can't be used, which lets the implementation do whatever it wants. That can be incrementally added to classes.
Another option is a "no__getattr__" attribute, which disables gettattr and friends.