pyvista.core._validation.check.check_number

Contents

pyvista.core._validation.check.check_number#

check_number(num: float, /, *, name: str = 'Object') None[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:
numnumbers.Number

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.

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)