On Jan 20, 2008 8:20 AM, Martin Albrecht <[EMAIL PROTECTED]> wrote: > > Hi there, > > I've submitted the patch > > http://trac.sagemath.org/sage_trac/ticket/1816 > > to trac and Nick refereed it. The patch implements that if a multivariate > polynomial ring is 'print'ed the output is quite verbose and structured. This > behavior was in repr_long() before. > > EXAMPLE: > > {{{ > sage: P.<x,y,z> = > PolynomialRing(QQ,order=TermOrder('degrevlex',1)+TermOrder('lex',2)) > sage: print P > Multivariate Polynomial Ring > Base Ring : Rational Field > Size : 3 Variables > Block 0 : Ordering : degrevlex > Names : x > Block 1 : Ordering : lex > Names : y, z > }}} > > Nick writes: "That's *not* okay -- way too much by default" but I disagree. > The motivation for adding more (structured) information to the long > representation came from the similar behavior of symbolic expressions: > > EXAMPLE: > > {{{ > sage: f = x/var('y') > sage: f > x/y > sage: str(f) > ' > x\r\n -\r\n > y' > sage: print f > x > - > y > }}} > > Thus I figured it would be okay to have long representations returned by > __str__. > > The question now is, how others think about it.
+1 I like your patch. But I would also very much like to hear what others think. Also, if one makes a free module M (say) over a multivariate polynomial ring R, I think the __repr__ method on M will do "... %s ..."%R, which will call R.__str__(), which will result in completely unreadable output. So we have to change a lot of __repr__ methods to use %r instead of %s. That's not necessarily bad; we had to do that with symbolic already. I can tell you also having been at a big IMA workshop on computational commutative algebra, that _users_ of commutative algebra software really do greatly appreciate things like: * clear verbose output * ASCII art / typesetting and anything else that makes staring at equations or formulas easier * automatic variable name injection (inject_on()). They seem to care much more about that sort of thing that say a typical number theorist or maybe crypto person. Your patch goes along with this theme well. -- William --~--~---------~--~----~------------~-------~--~----~ 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://www.sagemath.org -~----------~----~----~----~------~----~------~--~---