From ff080c79efd25c7809a47c34def68acbaa5904ae Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Thu, 17 Dec 2020 00:09:54 +0100 Subject: [PATCH 1/3] Add a `result_type` function to the API specification Identified as needed in gh-14, also came up in gh-43 and gh-91. --- spec/API_specification/utility_functions.md | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/API_specification/utility_functions.md b/spec/API_specification/utility_functions.md index aad65a71b..858605fb1 100644 --- a/spec/API_specification/utility_functions.md +++ b/spec/API_specification/utility_functions.md @@ -64,3 +64,27 @@ Tests whether any input array element evaluates to `True` along a specified axis - **out**: _<array>_ - if a logical OR reduction was performed over the entire array, the returned array must be a zero-dimensional array containing the test result; otherwise, the returned array must be a non-zero-dimensional array containing the test results. The returned array must have a data type of `bool`. + + +(function-result_type)= +### result_type(*arrays_and_dtypes) + +Returns the dtype that results from applying the type promotion rules +(see {ref}`type-promotion`) to the arguments. + +```{note} +If mixed dtypes (e.g. integer and floating-point) are used, the output of +`result_type` will be implementation-specific. +``` + +#### Parameters + +- **arrays_and_dtypes**: _List\[Union\[<array>, <dtype\]\];_ + + - input arrays and dtypes. + +#### Returns + +- **out**: _<dtype>_ + + - the dtype resulting from an operation involving the input arrays and dtypes. From 4db58df4311a94c5e57119fbee4be740fa95aeb5 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 28 Jan 2021 00:46:07 -0800 Subject: [PATCH 2/3] Fix missing bracket and semicolon --- spec/API_specification/utility_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/utility_functions.md b/spec/API_specification/utility_functions.md index 858605fb1..b7f58ee9b 100644 --- a/spec/API_specification/utility_functions.md +++ b/spec/API_specification/utility_functions.md @@ -79,7 +79,7 @@ If mixed dtypes (e.g. integer and floating-point) are used, the output of #### Parameters -- **arrays_and_dtypes**: _List\[Union\[<array>, <dtype\]\];_ +- **arrays_and_dtypes**: _List\[Union\[<array>, <dtype>\]\];_ - input arrays and dtypes. From 7e2483f4103d0d134a7ab3de5aec072c04bd2330 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Thu, 28 Jan 2021 15:18:37 +0100 Subject: [PATCH 3/3] Change List to Sequence in `result_type` annotation --- spec/API_specification/utility_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/utility_functions.md b/spec/API_specification/utility_functions.md index b7f58ee9b..a81b709ca 100644 --- a/spec/API_specification/utility_functions.md +++ b/spec/API_specification/utility_functions.md @@ -79,7 +79,7 @@ If mixed dtypes (e.g. integer and floating-point) are used, the output of #### Parameters -- **arrays_and_dtypes**: _List\[Union\[<array>, <dtype>\]\];_ +- **arrays_and_dtypes**: _Sequence\[Union\[<array>, <dtype>\]\];_ - input arrays and dtypes.