I have a class called User:
class User(object):
def __init__(self, arg1, ..., traits = None):
self.arg1 = arg1
...
self.traits = traits
User has a property traits
which is a dictionary. It's intended to be a catch-all that I can populate when I need to hold a bit more information about a user other than basic stuff like email address, userID, etc.
Would it be any more or less efficient to create a Traits
class, and set the properties in it's __init__
with setattr
? Would lookups work any better? Is there anything that this machinery would buy me, or is it just more work in the end?