I think I agree with Joel here. str(...) should give something which is suitable for embedding in text. In case of maxima objects it doesn't do that. In fact when I first encountered this behaviour I thought the str(...) function had a bug. It hadn't occurred to me that the \t's where for 2d display.
Since there is already a display2d method I don't see why str(...) could not return the 1D version. Michel On Jun 5, 7:42 pm, "Joel B. Mohler" <[EMAIL PROTECTED]> wrote: > On Tuesday 05 June 2007 12:09, William Stein wrote: > > > On 6/5/07, Joel B. Mohler <[EMAIL PROTECTED]> wrote: > > > sage: maxima('%s' % (repr(x^2+1),)) > > > x^2+1 > > > sage: maxima('%s' % (x^2+1,)) > > > .... This hangs because of the \t > > > By the way, I think this is a very bad way of moving > > symbolic expressions into Maxima. *Much* *much* better > > are any of the following: > > > (1) s = some symbolic expression > > (2) maxima(s) # underlying maxima object > > (3) s._maxima_init_() # the correct maxima string > > Ok, yes, I agree it's a bad way to do that. However, it's a very natural way > especially if you want to embed some other decorations along with the > expressions. I also use the % operator on strings for many other things > besides moving things to other systems -- indeed, I very rarely do that, it > just happened to be the instance that annoyed me right before that e-mail. > > I realize too from your other reply that you are following python conventions. > I'm still not entirely convinced that __str__ should be the 2D ascii display > though. Many users of the command line will never actually see the 2D ascii > display since there is no natural reason to use print from the command line. > That is, the 2D ascii display is not available as a non-python user would > intuitively expect and I think it breaks most other uses of __str__. > > -- > Joel --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---