Repository navigation
Update guidance for output array dtype inference in full_like - #274
Conversation
|
CC @honno |
FWIW, this matched the behavior of |
|
@asmeurer Correct, but |
|
Also, just to clarify, for all the |
asmeurer
left a comment
There was a problem hiding this comment.
I've mentioned before that I never quite understood the point of the *_like functions, but it does seem reasonable to me that they should try to make an array as "like" x as possible. And more to the point, this now matches the NumPy behavior. So this looks good to me.
Yes, it should be ignored. Compatibility does not apply for the I will update the guidance in a separate PR, however, to make this a bit more explicit. |
|
This has been approved and simply reverts to previous behavior. Merging... |
This PR
full_like.Discussion
In gh-167, guidance was changed (see gh-31) to infer the dtype from the
fill_value. However, this seems to have been a mistake, as scalar values do not have an array data type (onlyintorfloat) and do not participate in type promotion.This PR reverts this change, but also includes an explicit note that, if the
fill_valueis not of the same data type "kind" as the resolved output array data type, then behavior is left unspecified (e.g., ifx.dtypeisint64andfill_valueisfloat; e.g.,fill_value = 3.5).