What is the advantage or practical use of "magic" words in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the advantage or practical use of "magic" words in python?

My doubts are... you can use any word to call it, e.g. 'aaa', and futhermore you can designate any action inside it, even a contradiction, e.g.__add__ can substract! The only difference I understand so far is that these subfuntion has to precide by extra __init__ piece of code.

22nd Jun 2021, 6:23 AM
blackfish
blackfish - avatar
3 Answers
+ 1
overloading and custom classes, that arent used to interacting with eachother
22nd Jun 2021, 8:24 AM
Slick
Slick - avatar
0
Thanks for the answer, but would you mind explaining that a bit more.
10th Jul 2021, 9:50 AM
blackfish
blackfish - avatar
0
No need, look at this code. Let me know if you need a more in depth explination https://code.sololearn.com/c7cBU52EpJ58/?ref=app
10th Jul 2021, 9:52 AM
Slick
Slick - avatar