-
-
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
Table-like printing of a named-tuple of vectors #40121
Comments
This has come up before --- #24627 --- apparently I was in favor of it :) |
Ah cool. Maybe we can hook into the |
At one point, I looked into having NamedTuple display switch over to the Dict display code if the output was larger than one line; I really like the "single line" printing of small NamedTuples, but agree that it's pretty unwieldy when they get too big. The problem w/ the Dict approach is that code is kind of split over a few different places and, IMO, not factored to be very re-usable. |
Maybe a "general" solution would be to have a named tuple print like a table
unless the table is too wide then print like a Then the |
The thing I like about going from (
a = 1,
b = 2,
c = 3
) is you keep the same characters, it's just different whitespace, so it's still copy/pastable by default. |
(Yes, except that in the multiline form the last one should also have a trailing comma :) |
I've been working with named tuples recently and I noticed that all Parameters.jl does for their printing is call So i support Quinn's proposal here. |
As a named-tuple of vectors (along with a vector of named tuples) has become the de-factor "minimal" table, I'm wondering if we can change the printing of a named-tuple of vectors to something slightly more table-like.
Consider the output of
predict(m, X, interval = :confidence)
. Which returns a NamedTuple of VectorsHard to read. in R we get
Much easier to read.
I love named tuples of vectors (see my support here).
A package can't fix this without pretty severe type piracy, so I am filing the issue in base.
The text was updated successfully, but these errors were encountered: