[Python-ideas] The "in"-statement
Mike Graham
mikegraham at gmail.com
Mon Nov 5 21:29:06 CET 2012
More information about the Python-ideas mailing list
Mon Nov 5 21:29:06 CET 2012
- Previous message: [Python-ideas] The "in"-statement
- Next message: [Python-ideas] The "in"-statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Nov 5, 2012 at 2:49 PM, Serhiy Storchaka <storchaka at gmail.com> wrote: > On 05.11.12 21:28, Markus Unterwaditzer wrote: >> >> I thought it would be neat if i could do:: >> >> in obj: >> first_attr = "value" >> second_attr = "value2" > > > vars(obj).update( > first_attr="value", > second_attr="value2", > ) > > Or obj.__dict__.update. Tinkering with the object's attribute dict directly using either of these is extremely error-prone because it does not work for many objects and because it circumvents the descriptor protocol. Mike
- Previous message: [Python-ideas] The "in"-statement
- Next message: [Python-ideas] The "in"-statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list