On Wednesday 30 May 2007 14:00, Bobby Moretti wrote: > > On Wednesday 30 May 2007 12:14, William Stein wrote: > > > On 5/30/07, Joel B. Mohler <[EMAIL PROTECTED]> wrote: > > > > > 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. 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? > > > > > > Unfortunately I do not understand what you're suggesting. What is "the > > > sage script"? > > > What does "starting IPython" have to do with anything? Please clarify. > > > > Yes, I agree, that was a rather miserable description. I meant to > > trigger the > > extra variable insertions from the script in local/bin/sage-sage. It > > seems > > that there is one code-path from the options to running sage-ipython and > > a distinct code-path to run .sage/.py/.spyx scripts using sage-run. The > > variable insertions could be triggered directly before the sage-ipython > > call. > > > > I'm not entirely certain that I've comprehended the sage-sage bash script > > correctly. I'm also not entirely certain about all the technicalities of > > inserting the variables into the ipython namespace (I'm thinking that you > > would call a function -- e.g. inject_interactive_global_names() -- from > > the > > SAGE_STARTUP_COMMAND bash script variable). > > Nothing gets "injected" in the sense that a variable gets stuck into the > global namespace as a side-effect of some function call. Everything gets > imported. This is essentially independent of IPython. When sage starts up, > it runs: > > from sage.all import * > > and sage/all.py has lines like: > > from sage.rings.all import * > from sage.calculus.all import * > from sage.misc.all import * > ... > etc. > > All of the one-letter variables get assigned that way. Check out > > http://sagemath.org/hg/sage-main?f=8fbd25083520;file=sage/calculus/all.py > > to see where it all comes into play.
Yes, I understand all that. My use of the word "inject" was probably wrong. I'm just saying that these extra things which are nice for interactive use from ipython pollute the namespace for people who write python programs which have a line like "from sage.all import *". I think these convenience variables should be gathered out and injected into the ipython namespace separately (and in a central place in code). -- Joel --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@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-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---