pyvista.core._validation.check.check_number

Contents

pyvista.core._validation.check.check_number#

check_number(num, /, *, name='Object')[source]#

Check if an object is an instance of Number.

A number is any instance of numbers.Number, e.g. int, float, and complex.

Parameters:
numNumber

Number to check.

namestr, default: “Object”

Variable name to use in the error messages if any are raised.

Raises:
TypeError

If input is not an instance of Number.

See also

check_scalar

Notes

A NumPy ndarray is not an instance of Number.

Examples

Check if a complex number is an instance of Number.

>>> from pyvista import _validation
>>> _validation.check_number(1 + 2j)