8000 DOC: add release notes for ufunc NotImplemented/array_richcompare cha… · numpy/numpy@cbd544e · GitHub
[go: up one dir, main page]

Skip to content

Commit cbd544e

Browse files
committed
DOC: add release notes for ufunc NotImplemented/array_richcompare changes
1 parent 72060fc commit cbd544e

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

doc/release/1.10.0-notes.rst

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,23 @@ Highlights
1616
evaluation order.
1717
* Addition of `nanprod` to the set of nanfunctions.
1818

19+
Dropped Support:
1920

20-
Dropped Support
21-
===============
2221
* The polytemplate.py file has been removed.
2322
* The _dotblas module is no longer available.
2423
* The testcalcs.py file has been removed.
2524

25+
Future Changes:
2626

27-
Future Changes
28-
==============
27+
* In array comparisons like ``arr1 == arr2``, many corner cases
28+
involving strings or structured dtypes that used to return scalars
29+
now issue ``FutureWarning`` or ``DeprecationWarning``, and in the
30+
future will be change to either perform elementwise comparisons or
31+
raise an error.
2932
* The SafeEval class will be removed.
3033
* The alterdot and restoredot functions will be removed.
3134

35+
See below for more details on these changes.
3236

3337
Compatibility notes
3438
===================
@@ -250,6 +254,41 @@ array is writeable.
250254
Deprecations
251255
============
252256

257+
Array comparisons involving strings or structured dtypes
258+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259+
260+
Normally, comparison operations on arrays perform elementwise
261+
comparisons and return arrays of booleans. But in some corner cases,
262+
especially involving strings are structured dtypes, NumPy has
263+
historically returned a scalar instead. For example::
264+
265+
### Current behaviour
266+
267+
np.arange(2) == "foo"
268+
# -> False
269+
270+
np.arange(2) < "foo"
271+
# -> True on Python 2, error on Python 3
272+
273+
np.ones(2, dtype="i4,i4") == np.ones(2, dtype="i4,i4,i4")
274+
# -> False
275+
276+
Continuing work started in 1.9, in 1.10 these comparisons will now
277+
raise ``FutureWarning`` or ``DeprecationWarning``, and in the future
278+
they will be modified to behave more consistently with other
279+
comparison operations, e.g.::
280+
281+
### Future behaviour
282+
283+
np.arange(2) == "foo"
284+
# -> array([False, False])
285+
286+
np.arange(2) < "foo"
287+
# -> error, strings and numbers are not orderable
288+
289+
np.ones(2, dtype="i4,i4") == np.ones(2, dtype="i4,i4,i4")
290+
# -> [False, False]
291+
253292
SafeEval
254293
~~~~~~~~
255294
The SafeEval class in numpy/lib/utils.py is deprecated and will be removed

0 commit comments

Comments
 (0)
0