5. Clases and Interfaces¶
- 5.1. Compose Classes Instead of Nesting Many Levels of Built-in Types
- 5.2. Accept Functions Instead of Classes for Simple Interfaces
- 5.3. Use @classmethod Polymorphism to Construct Objects Generically
- 5.4. Initialize Parent Classes with super
- 5.5. Consider Composing Functionality with Mix-in Classes
- 5.6. Prefer Public Attributes Over Private Ones
- 5.7. Inherit from collections.abc for Custom Container Types