-
-
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
Array{Int,3}() should create an empty 3d array #14201
Comments
+1 I ran into this last week and had to do |
Note that high dimension arrays cannot be resized so it's unclear what is @Rory-Finnegan If you want |
@yuyichao Sorry, my initial use case was an empty 3-d array, but when I couldn't figure out how to do that I just preallocated a large one and used |
Honestly I'm not a fan of |
Type-stable placeholders. |
+1, at the very least to ensure consistency. |
Consistency with what? |
With N=1 and N=2? |
I'm not sure why this works for N=1 and N=2 in the first place. That seems like a misfeature to me. It's as if we've decided that the default size of dimensions is zero but only if we don't specify any dimensions. What?!?! That strikes me as absurd and I'm somewhat tempted to find out when we started supporting this. (It's probably my fault, 😬 .) For N=0 it makes sense since there are no dimensions to specify. |
The constructors with specified dimensions already all work: Array{Int,3}((2,3,4))
Array{Int}((2,3,4))
Array{Int,3}(2,3,4)
Array{Int}(2,3,4) |
The N=1 case actually kind of makes sense since we can at least grow those. |
The problem I have with the I agree that as a beginner, |
I'm more ok with |
Closed by #20330 |
Array{Int,1}()
andArray{Int,2}()
create empty 1d- and 2d-arrays, respectively. This could also be implemented for all higher dimensions.The text was updated successfully, but these errors were encountered: