Re: x.abc vs x['abc']

2009-05-15 Thread alex23
On May 14, 5:49 am, Gunter Henriksen wrote: > 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

Re: x.abc vs x['abc']

2009-05-13 Thread Chris Rebert
On Wed, May 13, 2009 at 1:00 PM, Christian Heimes wrote: > Gunter Henriksen wrote: >> 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

Re: x.abc vs x['abc']

2009-05-13 Thread Christian Heimes
Gunter Henriksen wrote: > 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.

x.abc vs x['abc']

2009-05-13 Thread 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: >>> d = {"hello": "w