Does __add__ for a class have to return a different class?

Sorry I I guess I’m having a hard time understanding.
for instance variables don’t we set it as instance.attribute=argument? With other.label it would be argument.attribute=argument? Which wouldn’t make sense. For me both of sodium & chlorine would be self.label & self.label? Sodium.label=“Na” & Chlorine.label=“Cl” Maybe I’m making it sound confusing…

self is one instance, other is the other. They can’t both have the same owner name.

When we invoke the method on sodium it looks for the other operand, chlorine.

Ok I understand now thank you!

1 Like