The biggest shortcoming of @property is that the methods for an attribute can only be shared by subclasses. Unrelated classes can’t share the same implementation. However, Python also supports descriptors (see Item 31: “Use Descriptors for Reusable @property Methods”) that enable reusable property logic and many other use cases.
- 4. Metaclasses and Attributes
- from Effective Python: 59 Specific Ways to Write Better Python
- Publisher: Addison-Wesley Professional
- Released: March 2015
This is how we do composition, I think.
Share this highlighthttp://www.safaribooksonline.com/a/effective-python-59/4165845/