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, andcomplex.- Parameters:
- num
numbers.Number Number to check.
- name
str, default: “Object” Variable name to use in the error messages if any are raised.
- num
- Raises:
TypeErrorIf input is not an instance of
Number.
Notes#
A NumPy ndarray is not an instance of Number.
Examples#
Download Python source code | Download Jupyter notebook
Check if a complex number is an instance of Number.
>>> from pyvista import _validation
>>> _validation.check_number(1 + 2j)