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

clarify that :compact prohibition on line breaks is for 2-arg show #55489

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ The following properties are in common use:

- `:compact`: Boolean specifying that values should be printed more compactly, e.g.
that numbers should be printed with fewer digits. This is set when printing array
elements. `:compact` output should not contain line breaks.
elements. `:compact` output for 2-argument [`show(io, x)`](@ref) should not contain line breaks.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elements. `:compact` output for 2-argument [`show(io, x)`](@ref) should not contain line breaks.
elements. `:compact` output should not contain line breaks.
This flag may be ignored for 3-argument [`show(io, mime, x)`](@ref).

I guess that this is what show for arrays and dictionaries does at present (apart from passing :compact on to the elements). It would also keep readers from asking themselves what "compact output with line breaks" may look like.

As expressed in the referenced Discourse thread, I would personally find a compact (human-readable) 3-argument show version quite useful. For this reason I suggest to add

Nevertheless, users are encouraged to take the `:compact` flag into account
when writing 3-argument `show` methods for the `"text/plain"` MIME type.

- `:limit`: Boolean specifying that containers should be truncated, e.g. showing `…` in
place of most elements.
- `:displaysize`: A `Tuple{Int,Int}` giving the size in rows and columns to use for text
Expand Down