diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-03-06 00:23:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 00:23:43 +0200 |
commit | ff4cfe7ecd46ee15fd88297964f6a5cb5423c291 (patch) | |
tree | ab318ae312db68d4329e23ade0457a9f026dbb4c /doc/source/reference | |
parent | 901211eddd5e17c8c7c85bc5f791679559d4efb5 (diff) | |
parent | a5a653d25e7329b9366be6f44b052d41bf297b0f (diff) | |
download | numpy-ff4cfe7ecd46ee15fd88297964f6a5cb5423c291.tar.gz |
Merge pull request #15534 from seberg/deprecate-abstract-scalar-types
DEP: Do not allow "abstract" dtype conversion/creation
Diffstat (limited to 'doc/source/reference')
-rw-r--r-- | doc/source/reference/arrays.dtypes.rst | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/source/reference/arrays.dtypes.rst b/doc/source/reference/arrays.dtypes.rst index e97ee3c3a..f8d40b13c 100644 --- a/doc/source/reference/arrays.dtypes.rst +++ b/doc/source/reference/arrays.dtypes.rst @@ -156,6 +156,14 @@ Array-scalar types Generic types + .. deprecated NumPy 1.19:: + + The use of generic types is deprecated. This is because it can be + unexpected in a context such as ``arr.astype(dtype=np.floating)``. + ``arr.astype(dtype=np.floating)`` which casts an array of ``float32`` + to an array of ``float64``, even though ``float32`` is a subdtype of + ``np.floating``. + The generic hierarchical type objects convert to corresponding type objects according to the associations: @@ -179,8 +187,7 @@ Built-in Python types :class:`float` :class:`float\_` :class:`complex` :class:`cfloat` :class:`bytes` :class:`bytes\_` - :class:`str` :class:`bytes\_` (Python2) or :class:`unicode\_` (Python3) - :class:`unicode` :class:`unicode\_` + :class:`str` :class:`str\_` :class:`buffer` :class:`void` (all others) :class:`object_` ================ =============== @@ -196,6 +203,11 @@ Built-in Python types >>> dt = np.dtype(int) # Python-compatible integer >>> dt = np.dtype(object) # Python object + .. note:: + + All other types map to ``object_`` for convenience. Code should expect + that such types may map to a specific (new) dtype in future the future. + Types with ``.dtype`` Any type object with a ``dtype`` attribute: The attribute will be |