We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
__class_getitem__
1 parent d9f11f2 commit 49f5358Copy full SHA for 49f5358
doc/release/upcoming_changes/19879.new_feature.rst
@@ -0,0 +1,15 @@
1
+``ndarray``, ``dtype`` and ``number`` are now runtime-subscriptable
2
+-------------------------------------------------------------------
3
+Mimicking :pep:`585`, the `~numpy.ndarray`, `~numpy.dtype` and `~numpy.number`
4
+classes are now subscriptable for python 3.9 and later.
5
+Consequently, expressions that were previously only allowed in .pyi stub files
6
+or with the help of ``from __future__ import annotations`` are now also legal
7
+during runtime.
8
+
9
+.. code-block:: python
10
11
+ >>> import numpy as np
12
+ >>> from typing import Any
13
14
+ >>> np.ndarray[Any, np.dtype[np.float64]]
15
+ numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]
0 commit comments