[Numpy-svn] [numpy/numpy] c5ad05: DEP: Deprecate boolean array indices with non-matc...

GitHub noreply at github.com
Sun Jun 7 09:08:20 EDT 2015


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: c5ad05813f36bbb65248d85bf1bacb2d0d60c368
      https://github.com/numpy/numpy/commit/c5ad05813f36bbb65248d85bf1bacb2d0d60c368
  Author: Sebastian Berg <sebastian at sipsolutions.net>
  Date:   2015-06-06 (Sat, 06 Jun 2015)

  Changed paths:
    M numpy/core/src/multiarray/mapping.c
    M numpy/core/src/multiarray/mapping.h
    M numpy/core/src/multiarray/multiarraymodule.c
    M numpy/core/tests/test_deprecations.py
    M numpy/core/tests/test_indexing.py
    M numpy/core/tests/test_multiarray.py
    M numpy/core/tests/test_regression.py

  Log Message:
  -----------
  DEP: Deprecate boolean array indices with non-matching shape

Boolean array indices will (unless the special case is taken)
always be converted using a nonzero logic. However, for example
```
arr = np.arange(10)
index = np.array([True])
arr[index]
```
would thus work as if index is filled up with `False`. This is
a source of confusion and hardly useful in practice. Especially
if the array has more then one dimension this behaviour can
be very unexpected as it conflicts with broadcasting.

Uses VisibleDeprecationWarning, since this is probably usually a
user bug in the first place.


  Commit: 01c59d63ad0356650571e239fffb9e7ee38c4c08
      https://github.com/numpy/numpy/commit/01c59d63ad0356650571e239fffb9e7ee38c4c08
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2015-06-07 (Sun, 07 Jun 2015)

  Changed paths:
    M numpy/core/src/multiarray/mapping.c
    M numpy/core/src/multiarray/mapping.h
    M numpy/core/src/multiarray/multiarraymodule.c
    M numpy/core/tests/test_deprecations.py
    M numpy/core/tests/test_indexing.py
    M numpy/core/tests/test_multiarray.py
    M numpy/core/tests/test_regression.py

  Log Message:
  -----------
  Merge pull request #4353 from seberg/boolean-bad-shape-dep

DEP: Deprecate boolean array indices with non-matching shape


Compare: https://github.com/numpy/numpy/compare/943ac81b58c7...01c59d63ad03


More information about the Numpy-svn mailing list