magic methods | SoloLearn: Learn to code for FREE!

0

magic methods

How can I use magic methods

5/6/2020 6:27:02 AM

KUSHAGRA MISRA

2 Answers

New Answer

+2

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.

+1

KUSHAGRA MISRA Use this 👇👇👇👇👇👇👇 https://www.geeksforgeeks.org/dunder-magic-methods-python/ Hope it helped