diff options
-rw-r--r-- | doc/release/upcoming_changes/19879.new_feature.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/release/upcoming_changes/19879.new_feature.rst b/doc/release/upcoming_changes/19879.new_feature.rst new file mode 100644 index 000000000..c6624138b --- /dev/null +++ b/doc/release/upcoming_changes/19879.new_feature.rst @@ -0,0 +1,15 @@ +``ndarray``, ``dtype`` and ``number`` are now runtime-subscriptable +------------------------------------------------------------------- +Mimicking :pep:`585`, the `~numpy.ndarray`, `~numpy.dtype` and `~numpy.number` +classes are now subscriptable for python 3.9 and later. +Consequently, expressions that were previously only allowed in .pyi stub files +or with the help of ``from __future__ import annotations`` are now also legal +during runtime. + +.. code-block:: python + + >>> import numpy as np + >>> from typing import Any + + >>> np.ndarray[Any, np.dtype[np.float64]] + numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]] |