On 22 Aug., 00:57, William Stein <wst...@gmail.com> wrote: > On Fri, Aug 21, 2009 at 3:18 PM, Simon King <simon.k...@nuigalway.ie> wrote: [...] > > sage: print M.str() > > but there might be nicer (and more intuitive!) ways. > > I think that is the only way. I can't think of any nicer way. Any idea > what it *should* be?
sage: M 29 x 29 dense matrix over Integer Ring sage: print M [ 100 201 892 ... In other words: If the user types a *command* to display M, then one can assume that (s)he really wants to see something (here: content of M). But if M is addressed without a command, it might be better to not confront the user with lengthy data. It's just a version of "explicit is better than implicit" - namely "using a command means more than not using a command". Therefore I believe that __repr__() should not necessarily coincide with __str__(). Why do I think that "print M.str()" is not intuitive? Since it is *two* commands, str() and print (without print it looks ugly). So, better might be a method with a descriptive name such as "prettyprint", "display", "print_all", etc. that returns None (rather than a string) but prints M to stdout. One problem in that approach is that there is already show() and plot () and so on. So, if there are too many display-related methods, it might be difficult to tell them apart. Perhaps: show() uses graphic, display() uses ascii art. Cheers, Simon --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---