Hey, I just started wondering about this as I came upon a code that expected an object with a certain set of attributes (but with no specification of what type this object shoul
If I understand your question correctly, you need records. Python classes may be used this way, which is what you do.
I believe the most pythonic way of dealing with "records" is simply... dictionaries! A class is a sort of dictionary on steroids.
Your class example data
is essentially a way of converting a dictionary into a class.
(On a side note, I would rather use self.__setattr__(name, kw[name])
.)