[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../generated/numpy.ndarray.__class_getitem__.html [Back]  [Original]

numpy.ndarray.__class_getitem__ — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.ndarray.__class_getitem__#

method

ndarray.__class_getitem__($cls, item, /)#

ndarray[shape, dtype]

Return a parametrized wrapper around the ndarray type.

New in version 1.22.

Returns:
aliastypes.GenericAlias

A parametrized ndarray type.

See also

PEP 585

Type hinting generics in standard collections.

numpy.typing.NDArray

An ndarray alias generic w.r.t. its dtype.type.

Examples

Try it in your browser!
>>> import numpy as np
>>> np.ndarray[tuple[int], np.dtype[np.uint8]]
numpy.ndarray[tuple[int], numpy.dtype[numpy.uint8]]

Web Proxy Viewer  |  New URL  |  Original Page