summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorAllan Haldane <ealloc@gmail.com>2018-02-17 05:41:24 +0100
committerGitHub <noreply@github.com>2018-02-17 05:41:24 +0100
commit4105af42c38539e8bf854c49134fe221d86ec79d (patch)
tree4e798418a4b20e644d7f65cdec2ec142c00fcbff /numpy/add_newdocs.py
parent04a87c57f672cfe6756fac2bf42d32bac351e2cf (diff)
parent348c47c20ab7f04f439a4a91f0652edfefffd576 (diff)
downloadnumpy-4105af42c38539e8bf854c49134fe221d86ec79d.tar.gz
Merge pull request #10554 from eric-wieser/promote_types-not-associative
DOC: promote_types is _not_ associative by design,
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 7dfecdb80..9740292bb 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -1775,7 +1775,7 @@ add_newdoc('numpy.core.multiarray', 'promote_types',
kind to which both ``type1`` and ``type2`` may be safely cast.
The returned data type is always in native byte order.
- This function is symmetric and associative.
+ This function is symmetric, but rarely associative.
Parameters
----------
@@ -1817,6 +1817,14 @@ add_newdoc('numpy.core.multiarray', 'promote_types',
>>> np.promote_types('i4', 'S8')
dtype('S11')
+ An example of a non-associative case:
+
+ >>> p = np.promote_types
+ >>> p('S', p('i1', 'u1'))
+ dtype('S6')
+ >>> p(p('S', 'i1'), 'u1')
+ dtype('S4')
+
""")
add_newdoc('numpy.core.multiarray', 'min_scalar_type',