English
Topic 10. Special methods and operator overloading, data classes and enumerations
Goal: learn to implement arithmetic and container protocols, design immutable values, data classes, and enumerations, and check consistency between equality, hashing, and operations.
Lecture contents
- The data model and arithmetic operations — The data model and special methods · Object representations for users and developers · Arithmetic operations and NotImplemented
- Comparison, hashing, and containers — Equality, ordering, and hashing · The container protocol and callable objects
- Context managers — Context managers
- Data classes and enumerations — Data classes and generated methods · Enumerations and flags · Structural class patterns · Testing value types and common mistakes