...

/

Set Method of the Descriptor Protocol

Set Method of the Descriptor Protocol

Learn about the set method of the descriptor protocol.

Signature of the __set__ method

The signature of this method is as follows:

__set__(self, instance, value)

This method is called when we try to assign something to a descriptor. It is activated with statements such as the one below, in which a descriptor is an object that implements __set__(). The instance parameter, in this case, would be client, and the value would be the "value" string:

client.descriptor = "value"
...