pyre.algebraic.Arithmetic

Module Contents

class pyre.algebraic.Arithmetic.Arithmetic

This is a mix-in class that traps the arithmetic operators relevant for numeric types

The point is to redirect arithmetic among instances of subclasses of {Arithmetic} to methods defined in these subclasses. These methods then build and return representations of the corresponding operators and their operands.

{Arithmetic} expects its subclasses to define two class methods: {literal} and {operator}. The former is used to encapsulate operands that are not {Arithmetic} instances. The latter is used to construct the operator representations

__add__(self, other)
__sub__(self, other)
__mul__(self, other)
__truediv__(self, other)
__floordiv__(self, other)
__mod__(self, other)
__pow__(self, other)
__pos__(self)
__neg__(self)
__abs__(self)
__radd__(self, other)
__rsub__(self, other)
__rmul__(self, other)
__rtruediv__(self, other)
__rfloordiv__(self, other)
__rmod__(self, other)
__rpow__(self, other)