summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/code_generators/ufunc_docstrings.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py
index 129516658..82cd6fb27 100644
--- a/numpy/core/code_generators/ufunc_docstrings.py
+++ b/numpy/core/code_generators/ufunc_docstrings.py
@@ -1835,6 +1835,17 @@ add_newdoc('numpy.core.umath', 'left_shift',
>>> np.left_shift(5, [1,2,3])
array([10, 20, 40])
+ Note that the dtype of the second argument may change the dtype of the
+ result and can lead to unexpected results in some cases (see
+ :ref:`Casting Rules <ufuncs.casting>`):
+
+ >>> a = np.left_shift(np.uint8(255), 1) # Expect 254
+ >>> print(a, type(a)) # Unexpected result due to upcasting
+ 510 <class 'numpy.int64'>
+ >>> b = np.left_shift(np.uint8(255), np.uint8(1))
+ >>> print(b, type(b))
+ 254 <class 'numpy.uint8'>
+
""")
add_newdoc('numpy.core.umath', 'less',