-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Labels
API changeChanges to existing functions or objects in the API.Changes to existing functions or objects in the API.topic: Type PromotionType promotion.Type promotion.
Milestone
Description
The array API's type promotion rules support mixed scalar/array operations, e.g., 1 + xp.arange(3)
.
For Xarray, we would like to be able to figure out the resulting dtype from this sort of operation before actually doing it (pydata/xarray#8946).
Ideally, we could use xp.result_type()
for this purpose, but as documented result_type only supports arrays and dtype objects. Could we potentially extend result_type
to also handle Python scalars? It is worth noting that this already works today in NumPy, e.g.,
>>> np.result_type(1, np.arange(3))
dtype('int64')
mdhaber
Metadata
Metadata
Assignees
Labels
API changeChanges to existing functions or objects in the API.Changes to existing functions or objects in the API.topic: Type PromotionType promotion.Type promotion.