Perfect Python Polymorphism. You are already using it!

preview_player
Показать описание
You want to understand Polymorphism and know how to use it in your code but you hear things like interfaces, types and things that can take many forms. But this only makes you think about ancient greek myths. I have good news for you. You are already using polymorphism in Python without realizing and in this video you learn what it is, what the world would look like without it and how you can use it in your custom classes.

C H A P T E R S
0:00 Polymorphism in the Python print function
1:10 Switch needed without Polymorphism
1:22 Violation of the open-closed principle
2:00 Dunder string (__str__) in Python built-in types
3:05 Make custom classes printable by overriding __str__
4:20 Polymorphism prevents switching on types

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

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

Thank you for the video. This is a great example in my opinion as it shows a practical use case and demonstrates very well with such a "simple" method like print, how powerful polymorphism can be

chrisk
welcome to shbcf.ru