Operator Overloading in Python: All you need to know to get started mastering OOP and Python Classes

Опубликовано: 08 Сентябрь 2019
на канале: Live Python
10,774
223

Want to understand non-trivial Python source code? Looking to take your knowledge and ability with Python Classes further? In this tutorial I'll introduce you to operator overloading and how to manipulate Python's syntax to make the classes you make flexible, robust and more like Python's built-in types.

Introduction 0:00
__init__() 0:15
What it means to overload an operator 0:54
_repr_ 1:19
_repr_ vs _str_ and when each is invoked 1:46
_add_ and binary operators 2:34
_radd_ and other right-sided operators 4:13
_iadd_ i.e. += 5:04
'moral of the story' 5:50
_getattr_ managed attributes 6:36
_getattribute_ 9:25
(hasattr 10:47)
recursion and the importance of super() 12:06
__call__, callbacks, GUIs, retained state 12:51


Смотрите видео Operator Overloading in Python: All you need to know to get started mastering OOP and Python Classes онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Live Python 08 Сентябрь 2019, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 10,774 раз и оно понравилось 223 людям.