On Jan 20, 2008, at 2:47 PM, Simon King wrote: > 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.
I've always disliked this as well. It has never been very intrusive until the symbolics package though, but is now especially annoying when printing lists, or other compound objects. And having to do "print repr(x), repr(y)" seems kludgy compared to "print x, y" (either before the last line in a notebook cell, or within a function anywhere). If we want to use "pretty printing" for symbolics I think it should be handled the same way jsmath representations are in the notebook. > 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. > > Hence, it makes sense to me that X.__repr__() (which is invoked by > sage: X) just returns a brief description, while X.__str__() (invoked > by sage: print X) can be more lengthy and should be descriptive enough > to reconstruct X. I think that we have (justifiably) moved away from the requirement that str(x) be descriptive enough to reconstruct x in all cases, and instead focus on good pickling. If one wants more information about x, one can call functions on it, like asking for its parent (rather than requiring parents to be printed in str representations). It has never been very intuitive (to me, at least) to remember which of repr vs. str is the long one, and which is used for print. - 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 -~----------~----~----~----~------~----~------~--~---