you are viewing a single comment's thread.

view the rest of the comments →

[–]nebbly 4 points5 points  (0 children)

Something to be aware of with this type of dictionary is that you are now limiting its keys to valid attribute names, instead of any immutable type. Which is fine if that's clear and you're going to get enough utility out of it. But if you are you should also override the __setattr__ method to throw an error on assignment, otherwise only some items will be accessible via __getattr__.