summaryrefslogtreecommitdiff
path: root/numpy/core/include
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2023-01-20 13:00:56 +0100
committerSebastian Berg <sebastianb@nvidia.com>2023-01-20 15:28:48 +0100
commitcc6fb9c999594e969a09d44dfb9f08ecd918b96e (patch)
treee7278a9d3c945cc22811b411c26b6c15d9e5a70d /numpy/core/include
parent10e4b8af2e123bc378fe90e10667489a109f47a9 (diff)
downloadnumpy-cc6fb9c999594e969a09d44dfb9f08ecd918b96e.tar.gz
DOC: Adept code comments for clarity based on code review
Co-authored-by: Matti Picus <matti.picus@gmail.com>
Diffstat (limited to 'numpy/core/include')
-rw-r--r--numpy/core/include/numpy/experimental_dtype_api.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/core/include/numpy/experimental_dtype_api.h b/numpy/core/include/numpy/experimental_dtype_api.h
index a1418e929..86ad15f37 100644
--- a/numpy/core/include/numpy/experimental_dtype_api.h
+++ b/numpy/core/include/numpy/experimental_dtype_api.h
@@ -332,11 +332,13 @@ typedef int (PyArrayMethod_StridedLoop)(PyArrayMethod_Context *context,
*
* @param context The arraymethod context, mainly to access the descriptors.
* @param reduction_is_empty Whether the reduction is empty. When it is, the
- * default value for the identity might differ, for example:
+ * value returned may differ. In this case it is a "default" value that
+ * may differ from the "identity" value normally used. For example:
* - `0.0` is the default for `sum([])`. But `-0.0` is the correct
* identity otherwise as it preserves the sign for `sum([-0.0])`.
* - We use no identity for object, but return the default of `0` and `1`
- for the empty `sum([], dtype=object)` and `prod([], dtype=object)`.
+ * for the empty `sum([], dtype=object)` and `prod([], dtype=object)`.
+ * This allows `np.sum(np.array(["a", "b"], dtype=object))` to work.
* - `-inf` or `INT_MIN` for `max` is an identity, but at least `INT_MIN`
* not a good *default* when there are no items.
* @param initial Pointer to initial data to be filled (if possible)