What difference between init & add method? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What difference between init & add method?

11th Jan 2020, 12:07 PM
💻SV💻
2 Answers
+ 2
hi
9th Mar 2020, 8:21 AM
Sarwar Hawramy
Sarwar Hawramy - avatar
+ 1
__init__ is for initializing an instance when you create it, like setting initial values. __add__ is for defining what happens if you use binary operator + with an instance. So in short: No relation.
11th Jan 2020, 12:53 PM
HonFu
HonFu - avatar