Presentations
Templates
Features
Teams
Pricing
Log in
Sign up
Log in
Sign up
Menu
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
Multiple Inheritance & Mixins
By Hack Bulgaria
Made with Slides.com
Multiple Inheritance & Mixins
Programming 101 with Python / 2019 week 05
1,095
Hack Bulgaria
github.com/HackBulgaria
hackbulgaria.com
hackbulgaria
More from
Hack Bulgaria