Multiple Inheritance &
Mixins
Recap
inheritance/OOP
super()
__dunders__
name mangling
setattr/getattr
@classmethod
Multiple Inheritance
(Examples)
Going deeper in inheritance
MRO
(
M
ethod
R
esolution
O
rder)
Python uses
C3
Linearization
to build it's MRO
Foo.mro()
dir(foo)
More on MRO and C3:
https://medium.com/technology-nineleaps/python-method-resolution-order-4fd41d2fcc
https://www.programiz.com/python-programming/multiple-inheritance#multilevel
Mixins
conception
Another level of abstraction
Python's
"interfaces"
Why should I use it?
You want to have a feature that
all
inheritors have
You want to have a feature that
some
of the
inheritors have
Mixins are usually described as being
included
rather than being
inherited
Made with Slides.com