What the function of magic methods ? gimme one example, i confuse with magic methods useful | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What the function of magic methods ? gimme one example, i confuse with magic methods useful

help mee guyss !!!

30th Oct 2016, 9:25 AM
M. Iqbal Maulana
M. Iqbal Maulana - avatar
3 Answers
+ 1
The major use of magic methods is operator overloading Checkout here:http://www.python-course.eu/python3_magic_methods.php
30th Oct 2016, 2:27 PM
மனோஜ்குமார் பழனிச்சாமி
மனோஜ்குமார் பழனிச்சாமி - avatar
+ 1
thank's bro
30th Oct 2016, 2:32 PM
M. Iqbal Maulana
M. Iqbal Maulana - avatar
0
other than operator overloading, __iter__ is very useful for me. example: class Animal: ... __iter__(self): //generator function ... yield x for x in Animal: print(x)
18th Dec 2016, 12:48 AM
Farhan Ramli
Farhan Ramli - avatar