-
-
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, showcompact, showall, showlimited, print, repr, summary, and friends #5709
Comments
Wow, I was not even aware of It seems that When this is available I can implement a Text Widget that automatically adapt its content while resizing. |
Of course, the limited and array flavors of show aren't exported (and as such aren't documented). But since the current repl uses showlimited to display objects to text/plain, it's what I've been using (along with show) to implement my types. I realized that my spitballed proposal wouldn't work; you'd want to magically dispatch both ways depending on if you're wanting to simplify writing or using the API. Currently,
And then the default implementation for showing unspecialized datatypes (e.g., what is currently Users writing new types could quickly get a simple display up quickly, but it also allows for a simple way to latch into full-functionality. And show(x) would still just work. I had initially thought about using (I'm still just getting into Julia… let me know if I'm overstepping any bounds here) |
You're right that It looks like
|
Ok, but is it currently possible to get a limited string representation of any type (or at least for arrays) that does not print the result? |
You can get the output of printing functions with |
Wow, this is great thanks |
I suppose I should be more specific in outlining what I'd like show to support, and why I think it'd be worth refactoring all these various
It'd be absolutely amazing to have something like this out of the box:
Now, to get this sort of effect currently, you have to ask for a larger representation than what is needed and search for newlines. And since there's no consistency in what summary information is shown, you can't be clever about omitting it if the values are all the same concrete type. I started work on adding variable keyword parameters to all |
Also related #6269 |
Significant refactoring is unlikely on release-0.4, removing from 0.4.x milestone. |
see #14052 proposal for latest cleanup plans |
As discussed elsewhere: we need to add an enum to express the available verbosity levels. |
Converted to a doc issue to explain how the output system works more. |
Can we close this now? |
We no longer have
|
In creating PR #5706 I had some trouble in figuring out what all the different flavors of show do. There seems to be some consensus on what information should be displayed when pretty-printing types, often like:
But how this happens, and, more importantly, how output is limited seems to be somewhat haphazard. In turn, it's hard for users to determine which functions should be implemented for their types — it took me a long time to realize that
showcompact
is orthogonal toshowlimited
(the former does things like shortening floating point precision while the latter omits elements, if I now understand correctly.)I searched through the issues and while there's some smattering of discussion about specific datatypes and there are some todo notes in the code but I thought there might be some value in looking at the overall architecture. With IJulia and REPL.jl around the corner, it might be nice to standardize some of these functions. I'm sure @tknopp will have some thoughts here as he implements his workspace browser.
As I see it, there are two or three different feature sets that are important for writing to
MIME"text/plain"
:Of course, what makes this difficult is that in the implementation, you generally only want to use one function with minor adjustments. Would the situation be improved with just one show API along the lines of the amazing showarray (albeit without keyword arguments)?
Users could choose to ignore the final arguments and multiple dispatch could be setup to ignore them if users only defined it in terms of the first two arguments. This is just a spitball to get the discussion rolling… is there interest in doing something here?
The text was updated successfully, but these errors were encountered: