diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-18 12:13:32 -0800 |
---|---|---|
committer | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-18 12:13:32 -0800 |
commit | ee06d183c407ea315b2eb3ef41ee422b0ea30251 (patch) | |
tree | 63f342953c62be3ff4d991a6c2559c11d8233c53 /numpy/add_newdocs.py | |
parent | cce7e1fcfa49b2fe8e1b9c1530269fdcebade14b (diff) | |
download | numpy-ee06d183c407ea315b2eb3ef41ee422b0ea30251.tar.gz |
ENH: core: Start converting ufunc to new iterator, add PyArray_PromoteTypes
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r-- | numpy/add_newdocs.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index 5e6a07bb0..92e438249 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -1178,6 +1178,46 @@ add_newdoc('numpy.core.multiarray', 'can_cast', """) +add_newdoc('numpy.core.multiarray', 'promote_types', + """ + promote_types(type1, type2) + + Returns the data type with the smallest size and smallest scalar + kind to which both ``type1`` and ``type2`` may be safely cast. + The returned data type is always in native byte order. Promotion of + string, unicode and void with numbers is disallowed. + + Parameters + ---------- + type1 : dtype or dtype specifier + First data type. + type2 : dtype or dtype specifier + Second data type. + + Returns + ------- + out : dtype + The promoted data type. + + Examples + -------- + >>> np.promote_types('f4', 'f8') + dtype('float64') + + >>> np.promote_types('i8', 'f4') + dtype('float64') + + >>> np.promote_types('>i8', '<c8') + dtype('complex128') + + >>> np.promote_types('i1', 'S8') + Traceback (most recent call last): + File "<stdin>", line 1, in <module> + TypeError: invalid type promotion + + + """) + add_newdoc('numpy.core.multiarray','newbuffer', """newbuffer(size) |