-
Notifications
You must be signed in to change notification settings - Fork 52
Cross-kind casting in asarray() #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'd expect this to work, because it's explicit. Unless there's an obvious alternative, like |
This is also relevant for the |
I guess there's actually three levels of dtype casting:
Presumably at the very least promotion should be allowed, otherwise the dtype parameter is useless, especially for the |
@asmeurer I am not seeing how the |
Oh yeah you are right about the _like functions (those always confuse me tbh because they seem rather pointless, but that's neither here nor there). |
Should asarray() allow arbitrary casting between dtypes if you call
asarray(x, dtype=dtype)
? It isn't really clear in the spec if, e.g.,asarray(x, dtype=bool)
should be required to work if x is an integer or float array, orasarray(x, dtype=float64)
if x is integer, and so on. My feeling is that it definitely should work ifdtype
is a promotable type fromx.dtype
, but I don't know if casts that aren't required to promote should also be required to work.The text was updated successfully, but these errors were encountered: