summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2016-05-08 14:12:57 -0400
committerCharles Harris <charlesr.harris@gmail.com>2016-06-15 14:25:40 -0600
commite22492340f9d89ee77f0dc3fbfcd499c855a9d14 (patch)
treea29072e41cfb25df53f167b660ec47f7c5243f4c /numpy/add_newdocs.py
parent4ccf3d7378a5dd9094a7e27c180eda01d7487278 (diff)
downloadnumpy-e22492340f9d89ee77f0dc3fbfcd499c855a9d14.tar.gz
ENH: Alias broadcast.ndim to broadcast.nd
Both `ndarray` and `nditer` spell this property `ndim`, so broadcast objects should too. The existing property remains for compatibility
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 46601b8ef..b00673d79 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -552,10 +552,26 @@ add_newdoc('numpy.core', 'broadcast', ('iters',
"""))
-add_newdoc('numpy.core', 'broadcast', ('nd',
+add_newdoc('numpy.core', 'broadcast', ('ndim',
"""
Number of dimensions of broadcasted result.
+ .. versionadded:: 1.12.0
+
+ Examples
+ --------
+ >>> x = np.array([1, 2, 3])
+ >>> y = np.array([[4], [5], [6]])
+ >>> b = np.broadcast(x, y)
+ >>> b.ndim
+ 2
+
+ """))
+
+add_newdoc('numpy.core', 'broadcast', ('nd',
+ """
+ Number of dimensions of broadcasted result. Alias for `ndim`.
+
Examples
--------
>>> x = np.array([1, 2, 3])