Under what circumstances are __rmul__ called?

后端 未结 3 1743
感情败类
感情败类 2020-12-02 13:15

Say I have a list l. Under what circumstance is l.__rmul__(self, other) called?

I basically understood the documentation, but I would also

3条回答
  •  死守一世寂寞
    2020-12-02 13:24

    __mul__() is the case of a dot product and the result of the dot product should be a scalar or just a number, i.e. __mul__() results in a dot product multiplication like x1*x2+y1*y2. In __rmul__() , the result is a point with x = x1*x2 and y = y1*y2 .

提交回复
热议问题