当前位置: 首页>>代码示例>>Python>>正文


Python operator.__truediv__方法代码示例

本文整理汇总了Python中operator.__truediv__方法的典型用法代码示例。如果您正苦于以下问题:Python operator.__truediv__方法的具体用法?Python operator.__truediv__怎么用?Python operator.__truediv__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在operator的用法示例。


在下文中一共展示了operator.__truediv__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _string_to_operator

# 需要导入模块: import operator [as 别名]
# 或者: from operator import __truediv__ [as 别名]
def _string_to_operator(self):
        operators = {
            "+": operator.__add__,
            "-": operator.__sub__,
            "*": operator.__mul__,
            "**": operator.__pow__,
            "/": operator.__truediv__,
            "//": operator.__floordiv__,
        }
        return operators[self.operator]

    ### PUBLIC PROPERTIES ### 
开发者ID:josiah-wolf-oberholtzer,项目名称:supriya,代码行数:14,代码来源:Pbinop.py

示例2: __truediv__

# 需要导入模块: import operator [as 别名]
# 或者: from operator import __truediv__ [as 别名]
def __truediv__(self, other):
        return self._operation(other, operator.__truediv__) 
开发者ID:mementum,项目名称:backtrader,代码行数:4,代码来源:lineroot.py

示例3: __rtruediv__

# 需要导入模块: import operator [as 别名]
# 或者: from operator import __truediv__ [as 别名]
def __rtruediv__(self, other):
        return self._roperation(other, operator.__truediv__) 
开发者ID:mementum,项目名称:backtrader,代码行数:4,代码来源:lineroot.py

示例4: __truediv__

# 需要导入模块: import operator [as 别名]
# 或者: from operator import __truediv__ [as 别名]
def __truediv__(self, other):
        assert isinstance(other, float) or isinstance(other, int) or isinstance(other, bool) or isinstance(other, Point)
        if isinstance(other, Point):
            return Point(__truediv__(self.x, other.x), __truediv__(self.y, other.y))
        else:
            return Point(__truediv__(self.x, other), __truediv__(self.y, other)) 
开发者ID:AlexKuhnle,项目名称:ShapeWorld,代码行数:8,代码来源:point.py

示例5: __div__

# 需要导入模块: import operator [as 别名]
# 或者: from operator import __truediv__ [as 别名]
def __div__(self, other):
        return self.__truediv__(other) 
开发者ID:AlexKuhnle,项目名称:ShapeWorld,代码行数:4,代码来源:point.py

示例6: __rtruediv__

# 需要导入模块: import operator [as 别名]
# 或者: from operator import __truediv__ [as 别名]
def __rtruediv__(self, other):
        assert isinstance(other, float) or isinstance(other, int) or isinstance(other, bool)
        return Point(__truediv__(other, self.x), __truediv__(other, self.y)) 
开发者ID:AlexKuhnle,项目名称:ShapeWorld,代码行数:5,代码来源:point.py


注:本文中的operator.__truediv__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。