setattr

setattr(object, name, value)

Sets a named attribute.

This is the counterpart of getattr. The arguments are an object, a string and an arbitrary value. The string may name an existing attribute or a new attribute. The function assigns the value to the attribute, provided the object allows it. For example, setattr(x, 'foobar', 123) is equivalent to x.foobar = 123.

 

A Django site. this page was rendered by a django application in 0.01s 2008-08-30 06:55:33.108642. hosted by webfaction.