Python operator 模块,__mul__() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用operator.__mul__()

项目:pynapl    作者:marinuso    | 项目源码 | 文件源码
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))
项目:pynapl    作者:marinuso    | 项目源码 | 文件源码
def product(seq):
    """The product of a sequence of numbers"""
    return reduce(operator.__mul__, seq, 1)
项目:ntypes    作者:AlexAltea    | 项目源码 | 文件源码
def __mul__(self, rhs):
        return op_binary(self, rhs, operator.__mul__)
项目:ntypes    作者:AlexAltea    | 项目源码 | 文件源码
def __rmul__(self, lhs):
        return op_binary(lhs, self, operator.__mul__)
项目:ntypes    作者:AlexAltea    | 项目源码 | 文件源码
def __imul__(self, v):
        return self.op_binary_inplace(v, operator.__mul__)
项目:ntypes    作者:AlexAltea    | 项目源码 | 文件源码
def __mul__(self, rhs):
        return op_binary(self, rhs, operator.__mul__)
项目:ntypes    作者:AlexAltea    | 项目源码 | 文件源码
def __rmul__(self, lhs):
        return op_binary(lhs, self, operator.__mul__)
项目:cpy2py    作者:maxfischer2781    | 项目源码 | 文件源码
def __mul__(self, other):
        with self._lock:
            return operator.__mul__(self.__wrapped__, other)

    # __div__ is py2 only
项目:cpy2py    作者:maxfischer2781    | 项目源码 | 文件源码
def __rmul__(self, other):
        with self._lock:
            return operator.__mul__(other, self.__wrapped__)
项目:Leetcode    作者:staticor    | 项目源码 | 文件源码
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'
项目:enterprise-fibonacci    作者:surrsurus    | 项目源码 | 文件源码
def multiply(typeA, typeB):
    return operator.__mul__(typeA.number.getNum(), typeB.number.getNum())
项目:codewars_python    作者:staticor    | 项目源码 | 文件源码
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'