|
|
|
|
|
by TBurette
1604 days ago
|
|
Writing a class that represents a property on an object so that you can reuse the property as many time as needed is nice. What is less nice is that the implementation of that idea in python is so tricky.
Descriptors come in two flavours and behave differently depending on their type : data descriptor and non data descriptor.
Doing something simple as having a descriptor writing a value in an object without clashing with other descriptors/objects is tricky. Thank god they added __set_name__ in 3.6. |
|