On 5/30/07, Joel B. Mohler <[EMAIL PROTECTED]> wrote: > > > On Tuesday 29 May 2007 23:50, William Stein wrote: > > > Is there a global > > > toggle to turn on/off this behavior? I can see the value of this in an > > > interactive setting, but when programming I would sometimes rather get > > > an error when trying to refer to a previously undefined object. > > > > There is currently no function to clear these, > > so I just wrote one. The attached patch adds a function clear_vars() > > that when called removes all 1-letter symbolic variables that are > > currently defined. > > I absolutely agree with the OP that these predefined things are not the > right > way to go for a programming environment.
These variables are predefined in exactly the same way that EllipticCurve or SymmetricGroup or any SAGE object is predefined. They are all imported from all.py, and are thus stuck in the global namespace. Wouldn't it be reasonable to cause > these one letter variables to be defined at the same point in the sage > script > where you start IPython? I think the same logic might apply to other > things > as well. I'm not quite sure what you mean here, but (I think) the behavior that you want is basically what's happening. We just manually define the identifiers a...z and A...Z in sage.calculus.all, assigning SymbolicVariable objects to them, in exactly the way any object gets assigned in python. Just typing sage: foo without defining foo will still raise an exception. I realize that if you have perfect spelling in your scripts and are > perfectly > anal about getting your variables defined before you use them, this makes > no > difference whatsoever, but... > > -- > Joel > > > > -- Bobby Moretti [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---
