-
-
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
improve REPL printing of sets #33300
Conversation
It is a bit different from how Array prints the
Not sure if it matters. |
It's on purpose, there is no particular ordering for sets, so printing the "last" elements (skippling middle ones) is not specially meaningfull compared to just printing elements until there is no more space. Note that this is how dicts are shown at the REPL (ellipsis at the end). Also, I plan to propose changing the |
Makes sense. |
base/show.jl
Outdated
function summary(io::IO, t::AbstractSet) | ||
n = length(t) | ||
showarg(io, t, true) | ||
print(io, " with ", n, (n==1 ? " entry" : " entries")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know dicts use "entries" but I think "elements" makes more sense for sets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I copy-pasted from dicts' method without thinking twice.
b633e53
to
fa1d3ef
Compare
Given the support received by this PR, I went ahead and fixed test failures. I think this would be good to go on my side if CI turns green. |
@@ -452,9 +452,6 @@ let a = Expr(:quote,Expr(:$,:x8d003)) | |||
@test eval(eval(Meta.parse(repr(a)))) == 2 | |||
end | |||
|
|||
# issue #9865 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue is now tested in other places of the code.
fa1d3ef
to
f327a4d
Compare
I like it and am tempted to merge but could you just add a NEWS note about the change? |
f327a4d
to
8b6298d
Compare
8b6298d
to
d6b654e
Compare
Good to go? triage? |
Oh I had not noticed you merged it, thanks! |
Compared to arrays and dicts, the default REPL printing of sets is less than ideal for inspecting values.
Master:
PR: