Advanced OOP

  1. Stringify class
  2. Multiple inheritance
  3. Multiple inheritance - diamond
  4. Interfaces
  5. Abstract Base Class
  6. Abstract Base Class with abc
  7. ABC working example
  8. ABC - cannot instantiate the base-class
  9. ABC - must implement methods
  10. Class Attributes
  11. Class count instances
  12. Destructor: __del__
  13. Class count instances - decrease also (destructor: __del__)
  14. Keep track of instances
  15. Keep track of instances properly (weakref)
  16. Destructor delayed
  17. Destructor delayed for both
  18. Class Attributes in Instances
  19. Attributes with method access
  20. Methods are class attributes - add method
  21. Methods are class attributes - replace method
  22. Methods are class attributes - Enhance method (Monkey patching)
  23. Method types
  24. Instance methods
  25. Class methods
  26. Class methods accessing class attributes
  27. Default Constructor
  28. Alternative constructor with class method
  29. Static methods
  30. Module functions
  31. Class and static methods
  32. Special methods
  33. Opearator overloading
  34. Operator overloading methods
  35. Declaring attributes (dataclasses)
  36. Dataclasses and __repr__
  37. Dataclasses and __eq__
  38. Dataclasses create __init__ and call __post_init__
  39. Dataclasses can provide default values to attributes
  40. Dataclasses and default factory
  41. Read only (frozen) Dataclass
  42. Serialization of instances with pickle
  43. Class in function
  44. Exercise: rectangle
  45. Exercise: SNMP numbers
  46. Exercise: Implement a Gene inheritance model combining DNA
  47. Exercise: imaginary numbers - complex numbers
  48. Solution: Rectangle
  49. Solution: Implement a Gene inheritance model combining DNA
  50. Instance Attribute
  51. Use Python @propery to fix bad interface (the bad interface)
  52. Use Python @propery to fix bad interface (first attempt)
  53. Use Python @propery to fix bad API
  54. Use Python @propery decorator to fix bad API
  55. Use Python @propery for value validation