Why doesn't it work for the built-in classes?
Is using a subclass the best approach to fix it, or will I run into some hidden problems?
a = {}
a.p = 1 # raises AttributeError
class B(dict):
pass
b = B()
b.p = 1 # works
EDIT: my original comment that it doesn't work for b
was incorrect (I made a mistake).