❮ links
❯
Advanced OOP
- Stringify class
- Multiple inheritance
- Multiple inheritance - diamond
- Interfaces
- Abstract Base Class
- Abstract Base Class with abc
- ABC working example
- ABC - cannot instantiate the base-class
- ABC - must implement methods
- Class Attributes
- Class count instances
- Destructor: __del__
- Class count instances - decrease also (destructor: __del__)
- Keep track of instances
- Keep track of instances properly (weakref)
- Destructor delayed
- Destructor delayed for both
- Class Attributes in Instances
- Attributes with method access
- Methods are class attributes - add method
- Methods are class attributes - replace method
- Methods are class attributes - Enhance method (Monkey patching)
- Method types
- Instance methods
- Class methods
- Class methods accessing class attributes
- Default Constructor
- Alternative constructor with class method
- Static methods
- Module functions
- Class and static methods
- Special methods
- Opearator overloading
- Operator overloading methods
- Declaring attributes (dataclasses)
- Dataclasses and __repr__
- Dataclasses and __eq__
- Dataclasses create __init__ and call __post_init__
- Dataclasses can provide default values to attributes
- Dataclasses and default factory
- Read only (frozen) Dataclass
- Serialization of instances with pickle
- Class in function
- Exercise: rectangle
- Exercise: SNMP numbers
- Exercise: Implement a Gene inheritance model combining DNA
- Exercise: imaginary numbers - complex numbers
- Solution: Rectangle
- Solution: Implement a Gene inheritance model combining DNA
- Instance Attribute
- Use Python @propery to fix bad interface (the bad interface)
- Use Python @propery to fix bad interface (first attempt)
- Use Python @propery to fix bad API
- Use Python @propery decorator to fix bad API
- Use Python @propery for value validation