[Tutor] kwargs to object proporties?

John Fouhy john at fouhy.net
Wed Mar 19 01:57:12 CET 2008


On 19/03/2008, Allen Fowler <allen.fowler at yahoo.com> wrote:
> Hello,
>
>  What's the best way convert keyword arguments to object properties?

You can mess around with self.__dict__.update(kwargs) or
update(locals()).  I'm not sure exactly what you want to do..

See this recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286185
It has some suggestions and discussion that you might find helpful.

-- 
John.


More information about the Tutor mailing list