RE: Problem with __sub__

2023-03-23 Thread David Raymond
I believe your problem is __rsub__, not __sub__. When you havethen that uses the "r" version of the operators. In your __rsub__ (used when you have - ) you instead return - which is backwards. Notice how the final return should also be -4,95 and not the +4,95 it's returning. > If on th

Problem with __sub__

2023-03-23 Thread Egon Frerich
The class Betragswert is used for numerical values as string or integer and for additions and subtraction. If on the left side is '0' the result of a subtraction is wrong. *    b1 = Betragswert(500)     b2 = 0 + b1     b3 = 0 - b1     b4 = 5 + b1     b5 = 5 - b1* print(b1, b2, b3, b4, b5) show