Say I have two objects (v1,v2) created from Vector Class. If v3 = -v1-v2, how can I find v3 using def __sub__(self, other): method?

Viewed 12

Normally operator overloading using def __sub__(self, other): works but in this case, I get this error message:

bad operand type for unary -: 'Vector'

What can I do about this?

0 Answers
Related