我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用operator.__mul__()。
def flatten_idx(self, idx, IO=0): return sum((x-IO)*(y-IO) for x,y in zip(scan_reverse(operator.__mul__,self.rho[1:]+[1]), idx))
def product(seq): """The product of a sequence of numbers""" return reduce(operator.__mul__, seq, 1)
def __mul__(self, rhs): return op_binary(self, rhs, operator.__mul__)
def __rmul__(self, lhs): return op_binary(lhs, self, operator.__mul__)
def __imul__(self, v): return self.op_binary_inplace(v, operator.__mul__)
def __mul__(self, other): with self._lock: return operator.__mul__(self.__wrapped__, other) # __div__ is py2 only
def __rmul__(self, other): with self._lock: return operator.__mul__(other, self.__wrapped__)
def ride(group,comet): from operator import __mul__ from functools import reduce kk = [ord(i) - ord('A') + 1 for i in group.upper()] ll = [ord(i) - ord('A') + 1 for i in comet.upper()] group = reduce(__mul__, kk) comet = reduce(__mul__, ll) return 'GO' if group % 47 == comet % 47 else 'STAY'
def multiply(typeA, typeB): return operator.__mul__(typeA.number.getNum(), typeB.number.getNum())