Opened 19 months ago
Last modified 5 months ago
#28180 needs_work enhancement
Sort dictionary keys and set elements in rich output
Reported by: | jaanos | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.3 |
Component: | user interface | Keywords: | fpsac2019 |
Cc: | aram.dermenjian | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | u/jaanos/sort_dictionary_keys_in_rich_output (Commits) | Commit: | a03bf7a2cf294166366b5bf95500c72c1a4b82a2 |
Dependencies: | Stopgaps: |
Description (last modified by )
This ticket introduces sorting of dictionary keys and set elements (including finite Set
s) in rich output, mimicking IPython's behaviour (actually, it uses IPython's _sorted_for_pprint
function for sorting).
It also avoids line breaks between the key and value in the LaTeX representation of dictionaries, and introduces sorting in the plain representation of finite Set
s.
Change History (9)
comment:1 Changed 19 months ago by
- Branch set to u/jaanos/sort_dictionary_keys_in_rich_output
comment:2 Changed 19 months ago by
- Commit set to f7afdf5b1328c78fad613165e07c10ff36d5df0f
- Component changed from PLEASE CHANGE to user interface
- Description modified (diff)
- Keywords fpsac2019 added
- Status changed from new to needs_info
- Type changed from PLEASE CHANGE to enhancement
comment:3 Changed 19 months ago by
- Commit changed from f7afdf5b1328c78fad613165e07c10ff36d5df0f to a03bf7a2cf294166366b5bf95500c72c1a4b82a2
comment:4 Changed 19 months ago by
- Cc aram.dermenjian added
- Description modified (diff)
- Status changed from needs_info to needs_review
- Summary changed from Sort dictionary keys in rich output to Sort dictionary keys and set elements in rich output
I have now reverted the layout changes in LaTeX representation of dictionaries, instead wrapping key-value pairs in {...}
, as suggested by Aram. Sorting is now also applied to Python's set
s and frozenset
s and Sage's finite Set
s (for which the representation is the same as for set
s, except when the Set
is empty).
comment:5 Changed 19 months ago by
- Description modified (diff)
comment:7 Changed 13 months ago by
- Milestone changed from sage-8.9 to sage-9.1
Ticket retargeted after milestone closed
comment:8 Changed 10 months ago by
- Milestone changed from sage-9.1 to sage-9.2
Batch modifying tickets that will likely not be ready for 9.1, based on a review of the ticket title, branch/review status, and last modification date.
comment:9 Changed 5 months ago by
- Milestone changed from sage-9.2 to sage-9.3
In the LaTeX output, the entire contents of the dictionary are now wrapped in big curly braces, as I don't know how to add them only to the first and last line (
\left\{ ... \right.
will not work, since there's a&
in between) - besides, their sizes may not match, which could be ugly. I guess we could have a horizontal layout if the dictionary could fit in a line, but I don't know how to check it (and it may be part of a longer line anyway, thus requiring line breaks).I will also add sorting for sets. This will require adding a new function to handle Python sets.
New commits:
Sort dict keys and align when displayed as LaTeX
Sort dict keys in character art
Update doctests