Python super. How does it work?

preview_player
Показать описание
Super allows you to call methods from base classes that are overridden in subclasses. But how does it work? And what does it look like? In this video you see an inheritance example and inspect super. You learn that super is not a function but a class that it allows you to override base class methods.

C H A P T E R S
0:24 Typical single inheritance example
0:47 Overriding __init__ in the subclass
1:01 Preventing duplicate code with super
2:05 super is not a function but a class
2:28 Using super in the subclass
3:49 super gives access to the base class initializer that was overridden in the subclass

M Y O N L I N E T R A I N I N G

L I N K S I N T H E V I D E O

#pythonforeveryone #programming #python
Рекомендации по теме
Комментарии
Автор

For videos like this one I wish I could give more than just one thumb up.

Zgl
Автор

Cheers mate, great explanation! I would LOVE a real deep dive on the super() class(!) <- thanks that i know this now ;)

steak
Автор

Love your simple explaination! Especially your tips to use inspect module, something that can be really useful to understand other complex code😀

clickandcodetech