check_if_numeric_type

(function from pyomo.common.numeric_types)

pyomo.common.numeric_types.check_if_numeric_type(obj)[source]

Test if the argument behaves like a numeric type.

We check for “numeric types” by checking if we can add zero to it without changing the object’s type, and that the object compares to 0 in a meaningful way. If that works, then we register the type in native_numeric_types.