G
Gunter Henriksen
Presuming it is very common to have objects created
on the fly using some sort of external data
definitions, is there an obvious common standard
way to take a dict object and create an object
whose attribute names are the keys from the dict?
I realize I can do something like:
world
but that seems like an arcane way to do something
which would ideally be transparent... if there is
a function in the standard library, that would be
good, even if I have to import it. I guess there is
collections.namedtuple... that would not look much
prettier... but the main thing to me is for it to
be the same way everybody else does it. I do not
prefer the new object be a dict, but it would be ok.
on the fly using some sort of external data
definitions, is there an obvious common standard
way to take a dict object and create an object
whose attribute names are the keys from the dict?
I realize I can do something like:
world
but that seems like an arcane way to do something
which would ideally be transparent... if there is
a function in the standard library, that would be
good, even if I have to import it. I guess there is
collections.namedtuple... that would not look much
prettier... but the main thing to me is for it to
be the same way everybody else does it. I do not
prefer the new object be a dict, but it would be ok.