Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Multiple Inheritance and Mixins

9da94e6b6107563a68d185a02137a32e?s=47 Dane Hillard
February 16, 2019

Multiple Inheritance and Mixins

This talk is an introduction to multiple inheritance in Python, and how to extend the API of classes via the mixin pattern. It touches on inheritance, superclasses, and a couple of real-world examples to illustrate its use.

9da94e6b6107563a68d185a02137a32e?s=128

Dane Hillard

February 16, 2019
Tweet

Transcript

  1. Dane Hillard @easyaspython Lead Web Application Developer, ITHAKA

  2. I’m writing a book 40% off: ctwpycaribbean19

  3. Multiple Inheritance and Mixins

  4. None
  5. None
  6. None
  7. None
  8. None
  9. __init__

  10. None
  11. super

  12. None
  13. Multiple inheritance

  14. None
  15. None
  16. None
  17. Method resolution order

  18. None
  19. None
  20. None
  21. Mule.__mro__

  22. None
  23. Mixins

  24. None
  25. None
  26. Things to remember

  27. MRO is king

  28. Keep mixins small

  29. Cooperative Inheritance

  30. Questions?

  31. A: Mixins are for extending an API