summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/neps/nep-0050-scalar-promotion.rst20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/neps/nep-0050-scalar-promotion.rst b/doc/neps/nep-0050-scalar-promotion.rst
index b39f8b6b5..63cf8f4be 100644
--- a/doc/neps/nep-0050-scalar-promotion.rst
+++ b/doc/neps/nep-0050-scalar-promotion.rst
@@ -555,6 +555,26 @@ passed out as a result from a function, rather than used only very localized.
or a pattern of calling ``np.result_type()`` before ``np.asarray()``.
+Keep using value-based logic for Python scalars
+-----------------------------------------------
+
+Some of the main issues with the current logic arise, because we apply it
+to NumPy scalars and 0-D arrays, rather than the application to Python scalars.
+We could thus consider to keep inspecting the value for Python scalars.
+
+We reject this idea on the grounds that it will not remove the surprises
+given earlier::
+
+ np.uint8(100) + 1000 == np.uint16(1100)
+ np.uint8(100) + 200 == np.uint8(44)
+
+And adapting the precision based on the result value rather than the input
+value might be possible for scalar operations, but is not feasible for array
+operations.
+This is because array operations need to allocate the result array before
+performing the calculation.
+
+
Discussion
==========