diff --git a/pyRCV2/numbers/base.py b/pyRCV2/numbers/base.py index 9dbe759..8bdf4a3 100644 --- a/pyRCV2/numbers/base.py +++ b/pyRCV2/numbers/base.py @@ -168,6 +168,8 @@ class BaseNum: class BasePyNum(BaseNum): """Helper class for Num wrappers of Python objects that already implement overloading""" + __slots__ = [] + _py_class = None # Subclasses must specify @classmethod diff --git a/pyRCV2/numbers/fixed_py.py b/pyRCV2/numbers/fixed_py.py index 8abde83..2e64dad 100644 --- a/pyRCV2/numbers/fixed_py.py +++ b/pyRCV2/numbers/fixed_py.py @@ -29,6 +29,8 @@ class Fixed(BasePyNum): Wrapper for Python Decimal (for fixed-point arithmetic) """ + __slots__ = [] + _py_class = decimal.Decimal # For BasePyNum ROUND_DOWN = decimal.ROUND_DOWN diff --git a/pyRCV2/numbers/gfixed_py.py b/pyRCV2/numbers/gfixed_py.py index 49afb08..233c409 100644 --- a/pyRCV2/numbers/gfixed_py.py +++ b/pyRCV2/numbers/gfixed_py.py @@ -34,6 +34,8 @@ class FixedGuarded(BasePyNum): Implements guarded (quasi-exact) fixed-point """ + __slots__ = [] + _py_class = decimal.Decimal # For BasePyNum ROUND_DOWN = decimal.ROUND_DOWN diff --git a/pyRCV2/numbers/native_py.py b/pyRCV2/numbers/native_py.py index c6908ee..6dfb23a 100644 --- a/pyRCV2/numbers/native_py.py +++ b/pyRCV2/numbers/native_py.py @@ -23,6 +23,8 @@ class Native(BasePyNum): Wrapper for Python float (naive floating-point arithmetic) """ + __slots__ = [] + _py_class = float # For BasePyNum def round(self, dps, mode): diff --git a/pyRCV2/numbers/rational_py.py b/pyRCV2/numbers/rational_py.py index 9b4de4c..7b62eba 100644 --- a/pyRCV2/numbers/rational_py.py +++ b/pyRCV2/numbers/rational_py.py @@ -24,6 +24,8 @@ class Rational(BasePyNum): Wrapper for Python Fraction (rational arithmetic) """ + __slots__ = [] + _py_class = Fraction # For BasePyNum def pp(self, dp):