Next / Previous / Contents / TCC Help System / NM Tech homepage

26.3.21. __setattr__(): Intercept all attribute changes

If a class defines it, this method is called whenever a new value is stored into an attribute. Calling sequence:

    def __setattr__(self, name, value):
        ...

The method sets the attribute given by the name argument to the value argument, or raises AttributeError if that operation is not permitted.