On Jan 20, 2008, at 11:13 PM, William Stein wrote:
> On Jan 20, 2008 2:58 PM, Nick Alexander <[EMAIL PROTECTED]> wrote: >> >> >> On 20-Jan-08, at 2:47 PM, Simon King wrote: >> >>> >>> Dear Nick >>> >>> On Jan 20, 8:24 pm, Nick Alexander <[EMAIL PROTECTED]> wrote: >>>> I've always hated that x/y and print x/y can do different things at >>>> the prompt, but it sounds like I'm fighting a losing battle. >>> >>> Sorry for coming into your discussion. I actually appreciate that >>> x/y >>> and print x/y do different things, for the following reason. >>> >>> If someone defines some sage object X and just types >>> sage: X >>> then the command is very short, and when i ask a short question, the >>> answer ought to be short as well. >>> >>> On the other hand, if the user's demand on displaying X is more >>> elaborate, such as >>> sage: print X >>> then the displayed information should be more elaborate as well. >> >> One reason that I don't like this is that in the notebook, only the >> final 'sage: X' shows that way. Before that, one must use print. >> Why the different semantics? >> > > Currently in the notebook we have this behavior: > > {{{id=14| > a = 5 > a > 2 + 2 > /// > 4 > }}} > > Nick asks why this doesn't happen: > > {{{id=14| > a = 5 > a > 2 + 2 > /// > 5 > 4 > }}} > > The answer is --- I couldn't figure out how to implement the latter > (in sage/server/notebook/worksheet.py). > That's it. I just don't know how to do it. It's nothing more > mysterious than that. If I could figure > out how to implement the latter I would. I'd imagine one would do it the same was as doctests, (almost) always assigning to a variable and then spitting out the string if it is not None... This doesn't solve the issue printing things from within a function (and detecting that would require more complicated parsing too). - 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://www.sagemath.org -~----------~----~----~----~------~----~------~--~---