isnumber#

isnumber(obj, isnan=None)[source]#

Determine whether or not the input is a number.

Identical to isinstance(obj, numbers.Number) unless isnan is specified.

Parameters:
  • obj (any) – the object to check if it’s a number

  • isnan (bool) – an optional additional check to determine whether the number is/isn’t NaN

New in version 3.2.0: use isinstance() directly