-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
float
implicitly broadcasts
#49929
Comments
This is intentional. |
right, but to me this really feels like broadcasting. It's not like it's converting a matrix to a float. It's taking all the entries and converting them separately. |
This has been discussed before. I can't find the issue now but I'm pretty sure @stevengj was involved. |
compare to |
Here's some of the previous discussion I mentioned #18495. Also #22236 (comment). |
even given those reasons to keep the functionality, it should still be |
It doesn't mutate the input argument so why should it have a |
woops. I was going off some of the earlier discussion in that issue you linked where it appears given that |
It doesn't the same thing, float(array) is no-op when array is already all floats, broadcast always creates a new array (and I've taken advantage of this in some packages). |
to me that seems like the worst and most dangerous of all worlds. it sometimes copies and sometimes doesn't? I guess so
|
It's the same thing that julia> v = [1.0,2.0,3.0]
3-element Vector{Float64}:
1.0
2.0
3.0
julia> convert(AbstractVector{Float64}, v) === v
true |
I did a little poking around and comparing to similar functions and I apologize for + retract some of my initial incredulity. here's what I got:
Actionable:
As for this issue, while it seems a bit more reasonable now, I still think the argument for |
float([2,3]) == [2.0, 3.0]
, but we should probably require this to be spelledfloat.([2,3])
(and my guess is this deprecation was missed in the 0.7 cycle. In the meantime, should we deprecate this?The text was updated successfully, but these errors were encountered: