Newbie Q: dynamically assigning object attribute

Dylan Moreland dylan.moreland at gmail.com
Thu Feb 9 21:08:04 EST 2006


No problem. There are, in fact, ugly class-based methods of doing this.
You could assign to an instance's __dict__ dictionary, or -- if the
class is a new-style class -- you can call the __setattr__(self, name,
value) method.




More information about the Python-list mailing list