We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

The __setattr__ method

__setattr__(self, name, value)

Called when an attribute assignment is attempted. This is called instead of the normal mechanism (i.e. store the value in the instance dictionary). name is the attribute name, value is the value to be assigned to it.

If __setattr__ wants to assign to an instance attribute, it should not simply execute “self.name = value” — this would cause a recursive call to itself. Instead, it should insert the value in the dictionary of instance attributes, e.g., “self.__dict__[name] = value”. For new-style classes, rather than accessing the instance dictionary, it should call the base class method with the same name, for example, “object.__setattr__(self, name, value)”.