You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UGens should support all mathematical operators available in Python via special methods.
Implement these special methods on synthdeftools.UGenMethodMixin, using the methods already defined there as a template (e.g. UGenMethodMixin.__add__(...)).
Some of these methods may already be implemented on the synthdeftools.Op class. When available, port those methods over from the staticmethods implemented on Op to bound instance methods on UGenMethodMixin. Remove the ported method from Op. Eventually, Op should be removed entirely.
It is not guaranteed that all Python operators will translate into SuperCollider UGen operators, or vice-versa. Use good judgement, and go with whatever is least surprising.
Consult the synthdeftools.UnaryOperator and synthdeftools.BinaryOperator enumerations for the names to use when building new operator methods.
Comparators:
object.__lt__(self, other)
object.__le__(self, other)
object.__gt__(self, other)
object.__ge__(self, other)
Do not implement __eq__ or __ne__. Implementing equality operators will cause other crucial functionality to break. Equality is already implemented via Op.is_equal(...) and Op.is_not_equal(...).
See below for more methods to not implement.
Basic arithmetic operations:
object.__add__(self, other)
object.__and__(self, other)
object.__floordiv__(self, other)
object.__lshift__(self, other)
object.__mod__(self, other)
object.__mul__(self, other)
object.__or__(self, other)
object.__pow__(self, other[, modulo])
object.__rshift__(self, other)
object.__sub__(self, other)
object.__truediv__(self, other)
object.__xor__(self, other)
Reflexives:
object.__radd__(self, other)
object.__rand__(self, other)
object.__rfloordiv__(self, other)
object.__rlshift__(self, other)
object.__rmod__(self, other)
object.__rmul__(self, other)
object.__ror__(self, other)
object.__rpow__(self, other)
object.__rrshift__(self, other)
object.__rsub__(self, other)
object.__rtruediv__(self, other)
object.__rxor__(self, other)
In-place operations:
object.__iadd__(self, other)
object.__iand__(self, other)
object.__ifloordiv__(self, other)
object.__ilshift__(self, other)
object.__imod__(self, other)
object.__imul__(self, other)
object.__ior__(self, other)
object.__ipow__(self, other[, modulo])
object.__irshift__(self, other)
object.__isub__(self, other)
object.__itruediv__(self, other)
object.__ixor__(self, other)
Unary operations:
object.__abs__(self)
object.__invert__(self)
object.__neg__(self)
object.__pos__(self)
Casting operations:
object.__float__(self)
object.__int__(self)
object.__round__(self[, n])
Do not implement:
object.__divmod__(self, other)
object.__eq__(self, other)
object.__ne__(self, other)
object.__matmul__(self, other)
object.__rdivmod__(self, other)
object.__imatmul__(self, other)
object.__rmatmul__(self, other)
The text was updated successfully, but these errors were encountered:
UGens should support all mathematical operators available in Python via special methods.
Implement these special methods on
synthdeftools.UGenMethodMixin
, using the methods already defined there as a template (e.g.UGenMethodMixin.__add__(...)
).Some of these methods may already be implemented on the
synthdeftools.Op
class. When available, port those methods over from thestaticmethods
implemented onOp
to bound instance methods onUGenMethodMixin
. Remove the ported method fromOp
. Eventually,Op
should be removed entirely.It is not guaranteed that all Python operators will translate into SuperCollider UGen operators, or vice-versa. Use good judgement, and go with whatever is least surprising.
Consult the
synthdeftools.UnaryOperator
andsynthdeftools.BinaryOperator
enumerations for the names to use when building new operator methods.Comparators:
object.__lt__(self, other)
object.__le__(self, other)
object.__gt__(self, other)
object.__ge__(self, other)
Do not implement
__eq__
or__ne__
. Implementing equality operators will cause other crucial functionality to break. Equality is already implemented viaOp.is_equal(...)
andOp.is_not_equal(...)
.See below for more methods to not implement.
Basic arithmetic operations:
object.__add__(self, other)
object.__and__(self, other)
object.__floordiv__(self, other)
object.__lshift__(self, other)
object.__mod__(self, other)
object.__mul__(self, other)
object.__or__(self, other)
object.__pow__(self, other[, modulo])
object.__rshift__(self, other)
object.__sub__(self, other)
object.__truediv__(self, other)
object.__xor__(self, other)
Reflexives:
object.__radd__(self, other)
object.__rand__(self, other)
object.__rfloordiv__(self, other)
object.__rlshift__(self, other)
object.__rmod__(self, other)
object.__rmul__(self, other)
object.__ror__(self, other)
object.__rpow__(self, other)
object.__rrshift__(self, other)
object.__rsub__(self, other)
object.__rtruediv__(self, other)
object.__rxor__(self, other)
In-place operations:
object.__iadd__(self, other)
object.__iand__(self, other)
object.__ifloordiv__(self, other)
object.__ilshift__(self, other)
object.__imod__(self, other)
object.__imul__(self, other)
object.__ior__(self, other)
object.__ipow__(self, other[, modulo])
object.__irshift__(self, other)
object.__isub__(self, other)
object.__itruediv__(self, other)
object.__ixor__(self, other)
Unary operations:
object.__abs__(self)
object.__invert__(self)
object.__neg__(self)
object.__pos__(self)
Casting operations:
object.__float__(self)
object.__int__(self)
object.__round__(self[, n])
Do not implement:
object.__divmod__(self, other)
object.__eq__(self, other)
object.__ne__(self, other)
object.__matmul__(self, other)
object.__rdivmod__(self, other)
object.__imatmul__(self, other)
object.__rmatmul__(self, other)
The text was updated successfully, but these errors were encountered: