Skip to content
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

RFC: Show single column array as permutedims of single row #31019

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
repr of a single-column matrix wraps in hcat to give the correct …
…return type.
  • Loading branch information
simonbyrne committed Apr 11, 2019
commit c02927b0eab2db19c8dd63a03ec52c6fa256f6c8
5 changes: 5 additions & 0 deletions base/arrayshow.jl
Original file line number Diff line number Diff line change
@@ -361,6 +361,11 @@ function _show_nonempty(io::IO, X::AbstractMatrix, prefix::String)
limit = get(io, :limit, false)::Bool
indr, indc = axes(X,1), axes(X,2)
nr, nc = length(indr), length(indc)
if nc == 1
print(io, prefix, "hcat(")
_show_nonempty(io, X, "")
return print(io, ")")
end
rdots, cdots = false, false
rr1, rr2 = UnitRange{Int}(indr), 1:0
cr1, cr2 = UnitRange{Int}(indc), 1:0
6 changes: 6 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
@@ -1475,5 +1475,11 @@ end
Z = Array{Float64}(undef,0,0)
@test eval(Meta.parse(repr(Z))) == Z


# issue #31065, do not print parentheses for nested dot expressions
@test sprint(Base.show_unquoted, :(foo.x.x)) == "foo.x.x"

# issue #31019: printing of single column matrix
Z = ones(3,1)
@test eval(Meta.parse(repr(Z))) == Z