On Jun 5, 2007, at 10:55 AM, [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 >>> >>> From my background, you would expect the canonical string >>> conversion to >>> naturally work. I use the % operator on strings a great deal so >>> I want >>> str(object) to nicely to embed strings, but clearly the author of >>> __str__ >>> doesn't use it so much -- maybe I'm unique in this. > > use %r to get the repr, %s gets the pretty string. > > sage: maxima('%r' % (x^2+1,)) > x^2+1
I have found the multi-line notion of str() odd too for this reason. I did not know about the "%r" command though (as it looks like few others did) $ grep -r "%s" sage | wc -l 6576 $ grep -r "%s" sage | grep -v repr | wc -l 6507 $ grep -r "%r" sage | wc -l 73 Perhaps this should be changed to be more inline with python standards. - Robert --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---