diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-09-15 13:17:17 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-09-15 13:33:32 +0200 |
commit | 49f53580e23bcf7dc305d97678125b34e1cff0cb (patch) | |
tree | f8545e8145591c971ab3d0d1ee9beb166dc0d44c | |
parent | d9f11f28a6048569f05d02fa7c1fa665a7ab86e4 (diff) | |
download | numpy-49f53580e23bcf7dc305d97678125b34e1cff0cb.tar.gz |
DOC: Add a release note for `__class_getitem__`
-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]] |