-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Pretty Console Output --> ascii art #14266
Comments
patch |
Attachment: pretty_console_print-EliX-jbp.patch.gz several examples (some not in the patch) |
comment:1
Attachment: pcp_monkey_patch.py.gz Whats the difference between |
comment:2
I implement I saw your handle ascii art and I try to send you a mail to merge that.... (no??). |
comment:3
I saw your email but #14040 has already been merged. What I'm saying is, there should be more integration into the existing framework and less reinventing the wheel. Also nobody wants an ugly representation. You can't copy/paste matrices either. To get an input that recreates the object, we already have
|
comment:4
How about a %magic to switch to the sage input representation to the displayhook, e.g.:
or perhaps both (if |
comment:5
I don't reinventing the wheel... Then I prefere a nice LaTeX representation too but with some objects the LaTeX compilation is very slow.
I didn't know but... after try...
and
can be easily be copy. So I don't say I invented something... I just purpose something to work (In my case) easily with linear combination. |
comment:6
So the bug is that |
comment:7
I like the idea of a magic function "%sage_input on". And if every thing is ascii-art... I have some question: 1 - The 2 - How to use your code to get (easily) a list, a dict or whatever of some objects with an ascii-art output ? Your code implement only a hack for Matrix (or it was before...) no? --> If it is true my code suggests a solution (may be a bad one...) (Sorry for my very bad english) |
comment:8
I am a bit new on this discussion, but I want to add my contribution. I think having First, you don't want to change the repr of every combinatorial objects to have pretty prints, this will just break everything every where. (I am thinking of trees, Dyck paths, partitions...). Most objects already had a way being pretty printed, it was just not centralized and could not be used in linear combinations. I actually think having the two |
comment:9
Replying to @vbraun:
There is definitely a need for a configurable display. In combinatorics
or if you are french
Another example is graphs. Currently we only have So I definitely see a need for configurable output. Florent |
comment:10
I don't agree with your partition example: It should just print ascii-art (with some cutoff if the tableau gets too large) and provide a method to get the tuple-of-integers. Which you need anyways. And the French should get along with the program and get used to the same notation as the rest of the world ;-) Seriously, we should first of all think about sane defaults that are as expressive as possible without being overly verbose. Just making everything configurable is a lame cop-out where you admit that you couldn't be bothered thinking about good defaults. If you want to see some other representation then you can always add an extra method. Why do you want a %magic to always print graphs as incidence matrix if you can just call the |
comment:11
I would recommend using the |
comment:12
Replying to @vbraun:
Unforunately, I seems that many combinatorialist agree with me. Please se the beginning of the |
new ascii art version. That one is compatible with the Braun's displayhook. It uses sympy to rewrite expression (or try to rewrite)::
(FIXME:: For that I have to use utf-8 output for that I use a hack in sage/all_cmdline.py...) I implement several pretty_repr for combinatorial object and plug that for free_module::
The AsciiArt module (old PrettyConsolRepr) purpose a 'new' option of baseline. |
Attachment: trac_14266_pretty_console_print-EliX-jbp.patch.gz new ascii art version |
comment:15
Looks pretty nice! I'm fine with the functionality, but the documentation needs to be improved. Especially since you want to provide other developers a framework to enable ascii art output. Some of the names are awkward in English. Pretty console representation means that the console is pretty, not the repr(esentation). It would be nice (and it would make writing doctests easier) if we install a global function analogous to Similarly, I don't like Also, since this should be a general framework we should add a default
Finally, |
comment:16
Replying to @vbraun:
I'm not a big fan of
I like the
+1
I would also like to see Thanks, Travis |
comment:17
It would be even better if default I played with |
comment:18
Replying to @novoselt:
There are other implementations of that idea, for example AsciiTeX. But that's not what this ticket is about. |
comment:19
Replying to @tscrim:
Sounds good to me. |
comment:20
Attachment: trac_14266_ascii_art_module-EliX-jbp.patch.gz New version with several tests for lot of methods... with I hope I don't forget anything. Enjoy. Thanks, |
comment:21
I see you are developing your own whitespace style. Unfortunately, its a slap in Guido Rossum's face. Can you have a look at pep8 ( http://www.python.org/dev/peps/pep-0008/#whitespace-in-expressions-and-statements)?
|
comment:68
Ok, applies to plain sage-5.10.beta5. It does conflict with #14523, though. Changes look good to me. |
comment:69
I just noticed that the sympy output is dependent on the terminal width:
|
This comment has been minimized.
This comment has been minimized.
Attachment: trac_14266_terminal_width.patch.gz Initial patch |
comment:71
Last patch disables sympy terminal width detection during doctesting. If you are happy with it, set ticket to positive review. Patchbot: apply trac_14266_ascii_art_13_05_15_EliX-jbp.patch, trac_14266-ascii_art-review-ts.patch, trac_14266_terminal_width.patch |
comment:72
Looks good to me. Thanks Volker. |
comment:73
Replying to @tscrim:
Beware though that trac_14266_terminal_width.patch introduces trailing whitespace. |
comment:74
If you don't like trailing whitespace then feel free to work on commit hooks that check for it. |
comment:75
Replying to @vbraun:
The sage dev scripts will strip them away for us. Which is how I actually detected this for I got a conflict when importing stuff into sage-git ... Do whatever you wish here; I just thought I might as well report the information. |
comment:76
In case anyone cares, here is the version without trailing whitespaces I put in the Sage-Combinat queue to ease my playing with importing into git. http://combinat.sagemath.org/patches/file/tip/trac_14266_terminal_width.patch |
Merged: sage-5.11.beta0 |
comment:78
the ascii_art doesn't work with notebook. |
Attachment: trac_14266_ascii_art_with_notebook.patch.gz |
My patch creates a simple ascii-art module to manipule several structure: list,dict,tuple, linear expression:
Apply:
Depends on #8703
Depends on #14203
Depends on #14574
CC: @nthiery @VivianePons
Component: user interface
Keywords: ascii-art
Author: Jean-Baptiste Priez
Reviewer: Volker Braun, Travis Scrimshaw
Merged: sage-5.11.beta0
Issue created by migration from https://trac.sagemath.org/ticket/14266
The text was updated successfully, but these errors were encountered: