def test_number(value): """Return true if the variable is a number.""" return isinstance(value, integer_types + (float, complex, decimal.Decimal))