Python Professional — Hard
Key points
- __set_name__ helps the descriptor identify its own name automatically.
- It is called when the class is created, not each time the descriptor is set on an instance.
- It does not set the name of the descriptor class in the owner's namespace.
- It does not define a custom name for the descriptor in repr().
Ready to go further?
Related questions
