import operator


def math_method(name, right=False):
    def wrapper(self, other):
        value = self.value
        math_func = getattr(operator, name)

        if right:
            value, other = other, value

        result = math_func(value, other)
        return type(self)(result, units=self.units)

    return wrapper


class MimicFloat(type):

    overrride_methods = ('__add__', '__sub__', '__mul__', '__truediv__')
    overrride_rmethods = ('__radd__', '__rsub__', '__rmul__', '__rtruediv__')

    def __new__(cls, name, bases, namespace):
        for method in cls.overrride_methods:
            namespace[method] = math_method(method)

        for rmethod in cls.overrride_rmethods:
            method = rmethod.replace('__r', '__')
            namespace[rmethod] = math_method(method, right=True)

        return super(MimicFloat, cls).__new__(cls, name, bases, namespace)

@@ -1,8 +1,36 @@
+from functools import wraps%0A
 import o
@@ -71,24 +71,87 @@
 ght=False):%0A
+    math_func = getattr(operator, name)%0A%0A    @wraps(math_func)%0A
     def wrap
@@ -198,52 +198,8 @@
 alue
-%0A        math_func = getattr(operator, name)
 %0A%0A  
@@ -399,25 +399,20 @@
 ):%0A%0A    
-overrride
+math
 _methods
@@ -467,25 +467,20 @@
 _')%0A    
-overrride
+math
 _rmethod
@@ -609,25 +609,20 @@
  in cls.
-overrride
+math
 _methods
@@ -707,17 +707,12 @@
 cls.
-overrride
+math
 _rme

Make math method wrapping nicer