-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
display and printingAesthetics and correctness of printed representations of objects.Aesthetics and correctness of printed representations of objects.
Description
julia> VERSION
v"1.2.0-DEV.146"
julia> show(Dict(true => false))
Dict(1=>0)Also,
julia> Dict(true => false)
Dict{Bool,Bool} with 1 entry:
true => falseseems to be inconsistent with
julia> [true => false]
1-element Array{Pair{Bool,Bool},1}:
1 => 0It looks like display(Dict(...)) does not set typeinfo while show(Dict(...)) does. Here is the code I used to check it:
function logio_show(io, mime)
push!(logio_log, ("mime", mime))
push!(logio_log, ("io isa IOContext", io isa IOContext))
if io isa IOContext
push!(logio_log, ("io.dict", io.dict))
end
print(io, "LogIO")
end
Base.show(io::IO, mime::MIME"text/plain", ::LogIO) =
logio_show(io, mime)
Base.show(io::IO, ::LogIO) =
logio_show(io, nothing)then
empty!(logio_log)
display(Dict(:a=>LogIO()))
logio_logshows
3-element Array{Any,1}:
("mime", nothing)
("io isa IOContext", true)
("io.dict", Base.ImmutableDict{Symbol,Any}(:compact=>true,:SHOWN_SET=>Dict(:a=>LogIO),:module=>Main,:limit=>true,:color=>true))(i.e., no typeinfo) while
empty!(logio_log)
show(Dict(:a=>LogIO()))
logio_logshows
3-element Array{Any,1}:
("mime", nothing)
("io isa IOContext", true)
("io.dict", Base.ImmutableDict{Symbol,Any}(:typeinfo=>LogIO,:compact=>true,:compact=>true,:typeinfo=>Pair{Symbol,LogIO},:SHOWN_SET=>Dict(:a=>LogIO),:color=>true))
i.e., typeinfo is set to LogIO.
Metadata
Metadata
Assignees
Labels
display and printingAesthetics and correctness of printed representations of objects.Aesthetics and correctness of printed representations of objects.