In the official Python documentation there are examples of descriptors.
Two of them are LoggedAccess and the Number validator:
class A:
logged = LoggedAccess()
validated = Number(maxvalue=30)
>>> a = A()
>>> a.logged = 50
INFO:root:Updating 'logged' to 50
>>> a.validated = 50
Traceback (most recent call last):
...
ValueError: Expected 50 to be no more than 30
I would like to use both in one attribute.
How can descriptors be reimplemented to support extensibility?
For example, used like this:
class A:
validated_and_logged = LoggedAccess() + Number(maxvalue=30)
>>> A().validated_and_logged = 50
INFO:root:Updating 'validated_and_logged' to 50
Traceback (most recent call last):
...
ValueError: Expected 50 to be no more than 30