Question: 3.4.1 About rmul_ etc When you write e.g. a b in Python, this is executed as a. mul(b). In our case, a might be an
3.4.1 About rmul_ etc When you write e.g. a b in Python, this is executed as a. mul(b). In our case, a might be an integer, and b might be an instance of our Complex class. This will give us trouble, because int's .mulmethod does not know how to work with instances of Complex. What python will do instead, is trying to execute b. rmul(a) instead. We don't execute b._mul(a), becuase we might have a case where a bba Name of file: complex.py, test.complex.py 3.4.1 About rmul_ etc When you write e.g. a b in Python, this is executed as a. mul(b). In our case, a might be an integer, and b might be an instance of our Complex class. This will give us trouble, because int's .mulmethod does not know how to work with instances of Complex. What python will do instead, is trying to execute b. rmul(a) instead. We don't execute b._mul(a), becuase we might have a case where a bba Name of file: complex.py, test.complex.py
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
