# numpy 2.5.4 (BSD-3-Clause), harvested by tools/harvest_corpus.py
=== input

    Returns True if the type of `element` is a scalar type.

    Parameters
    ----------
    element : any
        Input argument, can be of any type and shape.

    Returns
    -------
    val : bool
        True if `element` is a scalar type, False if it is not.

    See Also
    --------
    ndim : Get the number of dimensions of an array

    Notes
    -----
    If you need a stricter way to identify a *numerical* scalar, use
    ``isinstance(x, numbers.Number)``, as that returns ``False`` for most
    non-numerical elements such as strings.

    In most cases ``np.ndim(x) == 0`` should be used instead of this function,
    as that will also return true for 0d arrays. This is how numpy overloads
    functions in the style of the ``dx`` arguments to `gradient` and
    the ``bins`` argument to `histogram`. Some key differences:

    +------------------------------------+---------------+-------------------+
    | x                                  |``isscalar(x)``|``np.ndim(x) == 0``|
    +====================================+===============+===================+
    | PEP 3141 numeric objects           | ``True``      | ``True``          |
    | (including builtins)               |               |                   |
    +------------------------------------+---------------+-------------------+
    | builtin string and buffer objects  | ``True``      | ``True``          |
    +------------------------------------+---------------+-------------------+
    | other builtin objects, like        | ``False``     | ``True``          |
    | `pathlib.Path`, `Exception`,       |               |                   |
    | the result of `re.compile`         |               |                   |
    +------------------------------------+---------------+-------------------+
    | third-party objects like           | ``False``     | ``True``          |
    | `matplotlib.figure.Figure`         |               |                   |
    +------------------------------------+---------------+-------------------+
    | zero-dimensional numpy arrays      | ``False``     | ``True``          |
    +------------------------------------+---------------+-------------------+
    | other numpy arrays                 | ``False``     | ``False``         |
    +------------------------------------+---------------+-------------------+
    | `list`, `tuple`, and other         | ``False``     | ``False``         |
    | sequence objects                   |               |                   |
    +------------------------------------+---------------+-------------------+

    Examples
    --------
    >>> import numpy as np

    >>> np.isscalar(3.1)
    True

    >>> np.isscalar(np.array(3.1))
    False

    >>> np.isscalar([3.1])
    False

    >>> np.isscalar(False)
    True

    >>> np.isscalar('numpy')
    True

    NumPy supports PEP 3141 numbers:

    >>> from fractions import Fraction
    >>> np.isscalar(Fraction(5, 17))
    True
    >>> from numbers import Number
    >>> np.isscalar(Number())
    True

    
=== parse numpydoc
short_description: 'Returns True if the type of `element` is a scalar type.'
blank_after_short_description: True
blank_after_long_description: False
style: numpydoc
- DocstringParam
  description: 'Input argument, can be of any type and shape.'
  kind: param
  key: 'param'
  arg_name: 'element'
  type_name: 'any'
  is_optional: False
- DocstringReturns
  description: 'True if `element` is a scalar type, False if it is not.'
  kind: returns
  key: 'returns'
  type_name: 'bool'
  is_generator: False
  return_name: 'val'
- DocstringMeta
  description: 'ndim : Get the number of dimensions of an array'
  kind: text
  key: 'see_also'
  title: 'See Also'
- DocstringMeta
  description: |
    If you need a stricter way to identify a *numerical* scalar, use
    ``isinstance(x, numbers.Number)``, as that returns ``False`` for most
    non-numerical elements such as strings.
    
    In most cases ``np.ndim(x) == 0`` should be used instead of this function,
    as that will also return true for 0d arrays. This is how numpy overloads
    functions in the style of the ``dx`` arguments to `gradient` and
    the ``bins`` argument to `histogram`. Some key differences:
    
    +------------------------------------+---------------+-------------------+
    | x                                  |``isscalar(x)``|``np.ndim(x) == 0``|
    +====================================+===============+===================+
    | PEP 3141 numeric objects           | ``True``      | ``True``          |
    | (including builtins)               |               |                   |
    +------------------------------------+---------------+-------------------+
    | builtin string and buffer objects  | ``True``      | ``True``          |
    +------------------------------------+---------------+-------------------+
    | other builtin objects, like        | ``False``     | ``True``          |
    | `pathlib.Path`, `Exception`,       |               |                   |
    | the result of `re.compile`         |               |                   |
    +------------------------------------+---------------+-------------------+
    | third-party objects like           | ``False``     | ``True``          |
    | `matplotlib.figure.Figure`         |               |                   |
    +------------------------------------+---------------+-------------------+
    | zero-dimensional numpy arrays      | ``False``     | ``True``          |
    +------------------------------------+---------------+-------------------+
    | other numpy arrays                 | ``False``     | ``False``         |
    +------------------------------------+---------------+-------------------+
    | `list`, `tuple`, and other         | ``False``     | ``False``         |
    | sequence objects                   |               |                   |
    +------------------------------------+---------------+-------------------+
  kind: text
  key: 'notes'
  title: 'Notes'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> import numpy as np'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> np.isscalar(3.1)
    True
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> np.isscalar(np.array(3.1))
    False
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> np.isscalar([3.1])
    False
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> np.isscalar(False)
    True
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> np.isscalar('numpy')
    True
- DocstringExample
  description: 'NumPy supports PEP 3141 numbers:'
  kind: examples
  key: 'examples'
  snippet: '>>> from fractions import Fraction'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> np.isscalar(Fraction(5, 17))
    True
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> from numbers import Number'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> np.isscalar(Number())
    True
=== detect
numpydoc
=== compose numpydoc
Returns True if the type of `element` is a scalar type.

Parameters
----------
element : any
    Input argument, can be of any type and shape.

Returns
-------
val : bool
    True if `element` is a scalar type, False if it is not.

See Also
--------
ndim : Get the number of dimensions of an array

Notes
-----
If you need a stricter way to identify a *numerical* scalar, use
``isinstance(x, numbers.Number)``, as that returns ``False`` for most
non-numerical elements such as strings.

In most cases ``np.ndim(x) == 0`` should be used instead of this function,
as that will also return true for 0d arrays. This is how numpy overloads
functions in the style of the ``dx`` arguments to `gradient` and
the ``bins`` argument to `histogram`. Some key differences:

+------------------------------------+---------------+-------------------+
| x                                  |``isscalar(x)``|``np.ndim(x) == 0``|
+====================================+===============+===================+
| PEP 3141 numeric objects           | ``True``      | ``True``          |
| (including builtins)               |               |                   |
+------------------------------------+---------------+-------------------+
| builtin string and buffer objects  | ``True``      | ``True``          |
+------------------------------------+---------------+-------------------+
| other builtin objects, like        | ``False``     | ``True``          |
| `pathlib.Path`, `Exception`,       |               |                   |
| the result of `re.compile`         |               |                   |
+------------------------------------+---------------+-------------------+
| third-party objects like           | ``False``     | ``True``          |
| `matplotlib.figure.Figure`         |               |                   |
+------------------------------------+---------------+-------------------+
| zero-dimensional numpy arrays      | ``False``     | ``True``          |
+------------------------------------+---------------+-------------------+
| other numpy arrays                 | ``False``     | ``False``         |
+------------------------------------+---------------+-------------------+
| `list`, `tuple`, and other         | ``False``     | ``False``         |
| sequence objects                   |               |                   |
+------------------------------------+---------------+-------------------+

Examples
--------
>>> import numpy as np
>>> np.isscalar(3.1)
True
>>> np.isscalar(np.array(3.1))
False
>>> np.isscalar([3.1])
False
>>> np.isscalar(False)
True
>>> np.isscalar('numpy')
True

NumPy supports PEP 3141 numbers:

>>> from fractions import Fraction
>>> np.isscalar(Fraction(5, 17))
True
>>> from numbers import Number
>>> np.isscalar(Number())
True
