On 5/30/07, Joel B. Mohler <[EMAIL PROTECTED]> 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.

The debate about whether or not to include a bunch of predefined
indeterminates has been had and re-had several times. See, for example
http://groups.google.com/group/sage-devel/browse_thread/thread/96647186db5aee76/beb737e645c21937?lnk=gst&q=pre+define&rnum=1#beb737e645c21937
.

This would have the advantage of being a central place to manage global
> names
> to some extent.  This could help to combat and clarify namespace pollution
> (although I'm not saying that's a problem (yet)).

--
> Joel
>
> >
>


-- 
Bobby Moretti
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---

Reply via email to