On Jun 17, 2009, at 9:21 AM, William Stein wrote: > 2009/6/17 Robert Bradshaw <rober...@math.washington.edu>: >> >> On Jun 17, 2009, at 3:05 AM, Utpal Sarkar wrote: >> >>> Thanks for the replies. >>> I noticed something funny: if you call x = var("X") in some >>> scope, it >>> is X that is injected into the global scope, not x. In fact I >>> thought >>> that the argument was merely a print name. >> >> var("X") is what makes the variable, there's nothing special about >> assignment. For example, if I wrote >> >> sage: x = var("X") + 1 >> >> then x would have the value X + 1, and as a side effect, X would be >> injected into the global scope. This seems like a surprising artifact >> to many people, and is certainly not like anything Python does. Was >> there a strong justification for doing this? > > If I remember correctly: > > 1. The symbolic calculus code is not aimed at experience Python > programmers or users. > > 2. It is very nice for var('x,y,z,theta') to work, and to not require > the user to type: > x,y,z,theta = var('x,y,z,theta') > > 3. Having var at all is a compromise -- many symbolic calculus users > would prefer for undefined vars to just "magically" be defined, as is > done in Mathematica, Maple, Maxima, Axiom (?), etc.
That's enough justification for me. I'm still in favor of an optional "global" keyword to the var function that was brought up earlier. - Robert --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---