Robert Bradshaw wrote: > On Fri, 21 Aug 2009, Simon King wrote: > >> 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__(). > > One problem with this is that then one can't do "print M" and get what one > expects from a non-terminal line (e.g. inside a function, or anything but > the last line of a notebook cell).
Can you elaborate? I'm not sure what you're trying to say---what would one expect? I thought Simon was saying that print M would lead a user to expect the matrix to be printed out. I find print M.str() frustrating to remember, so I'm glad this may be resolved now. I typically first try "M", and then my natural instinct is to try "print M", thinking that if I tell Sage that I really want it to print everything out, it will. Thanks, Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---