On Mon, Jun 11, 2012 at 4:05 PM, Tom Bachmann <e_mc...@web.de> wrote: > Well, I think we should figure out what the various printing methods should > do. As far as I can tell we have: > > - plain str/repr (the same for technical reasons)
Aaron and Vinzent know more about this than I do. There was some discussion some time ago about this. (I don't have the ref at hand.) > - sstr and srepr > - pprint > > Now, as I see it, pprint is really what we use interactively. Depending on > the environment it might be ascii, unicode or latex, but in any case this is > the one that is supposed to look good. The main use of sstr is in doctests. > When is plain str ever used? That's almost all I ever see as the output in an interactive session. > > As far as I can see, pprint should just look good, and "str" should produce > something that, when passed to sympify, recreates the expression. What about > sstr? I don't know. > From my taxonomy above, sstr is also output-oriented, and as such > there does not seem to be a need for this to recreate the original > expression upon sympify. > Which of course would mean that the current > quasi-2d printing is fine, so I must be misunderstanding things... The only thing you can copy and paste into sympify (presently) is srepr(matrix). So the changes I proposed was to make the sstr output, that is used in the interactive setting, give something that is sympifiable: in my mprint branch: >>> m=Matrix([[1,2],[3,4]]) >>> m # the sstr form is printed Matrix([ [1, 2], [3, 4]]) >>> str(m) 'Matrix([[1, 2], [3, 4]])' >>> sstr(m) 'Matrix([\n[1, 2],\n[3, 4]])' >>> repr(m) 'Matrix([\n[1, 2],\n[3, 4]])' >>> srepr(m) 'Matrix([[Integer(1), Integer(2)], [Integer(3), Integer(4)]])' >>> S('''Matrix([ ... [1, 2], ... [3, 4]])''') Matrix([ [1, 2], [3, 4]]) /c -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.