Newbie Question: Giving names to Elements of List/Tuple/Dict

Duncan Booth duncan at rcp.co.uk
Mon Dec 2 04:33:17 EST 2002


Max M <maxm at mxm.dk> wrote in news:3DE89ECD.2040203 at mxm.dk:

> There is a special notes in the docs warning against changing the values 
>   that are returned from vars()
> 
> This is the more "correct" way to do it.
> 
>      class Struct:
>          def __init__(self, **kw):
>              self.__dict__.update(kw)

Indeed, I thought the warning only applied to vars() without an
argument, but I see that in fact it tells you not to modify the
dictionary from any scope. Thanks for the correction.



More information about the Python-list mailing list