def coerce_numbers_to_my_dtype(f):
 @wraps(f)
 def method(self, other):
  if isinstance(other, Number):
   other = coerce_to_dtype(self.dtype, other)
  return f(self, other)
 return method

def coerce_numbers_to_my_dtype ( f ) : @ wraps ( f ) def method ( self , other ) : if isinstance ( other , Number ) : other = coerce_to_dtype ( self . dtype , other ) return f ( self , other ) return method
a decorator for methods whose signature is f that coerces other to self .