magic methods | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

magic methods

How can I use magic methods

6th May 2020, 6:27 AM
KUSHAGRA MISRA
KUSHAGRA MISRA - avatar
1 ответ
+ 3
Magic methods are not meant to be invoked directly by you, but the invocation happens internally from the class on a certain action. For example, when you add two numbers using the + operator, internally, the __add__() method will be called. Built-in classes in Python define many magic methods.
6th May 2020, 7:01 AM
SITHU Nyein
SITHU Nyein - avatar