-
-
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
show of 0-dimensional array misleading #31481
Labels
arrays
[a, r, r, a, y, s]
display and printing
Aesthetics and correctness of printed representations of objects.
Comments
maleadt
added
test
This change adds or pertains to unit tests
display and printing
Aesthetics and correctness of printed representations of objects.
labels
Mar 26, 2019
Seems to be intentional: 303 # 0-dimensional arrays
304 print_array(io::IO, X::AbstractArray{T,0} where T) =
305 isassigned(X) ? show(io, X[]) :
306 print(io, undef_ref_str) But I'm not sure these are really desirable formats, except for 1-d and 2-d cases: julia> println(zeros(Float32))
0.0
julia> println(zeros(Float32, 2))
Float32[0.0, 0.0]
julia> println(zeros(Float32, 2, 2))
Float32[0.0 0.0; 0.0 0.0]
julia> println(zeros(Float32, 2, 2, 2))
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
julia> println(zeros(Float32, 2, 2, 2, 2))
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
julia> println(zeros(Float32, 2, 2, 2, 2, 2))
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Float32[0.0 0.0; 0.0 0.0]
Sure we do: 🙂 julia> fill(1.0)
0-dimensional Array{Float64,0}:
1.0 |
vtjnash
changed the title
Confusing output with failed comparison to 0-dimensional array
show of 0-dimensional array misleading
Mar 26, 2019
Intended display @vtjnash ? |
Ways we could display this:
Any other ideas? |
Triage says 👍 to changing this. |
I'm favoring |
This was referenced Sep 9, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
arrays
[a, r, r, a, y, s]
display and printing
Aesthetics and correctness of printed representations of objects.
Not sure what to do here since we don't have a short syntax for 0-dimensional arrays.
The text was updated successfully, but these errors were encountered: