0
What the function of magic methods ? gimme one example, i confuse with magic methods useful
help mee guyss !!!
3 odpowiedzi
+ 1
The major use of magic methods is operator overloading
Checkout here:http://www.python-course.eu/python3_magic_methods.php
+ 1
thank's bro
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)