> > > > > I understand.   It would indeed be god to have some sort of "preparse
> > > > > then import" command.  Any suggestions for how it would work (i.e.,
> > > > > from the user's point of view)?  Making
> > > > >      import foo
> > > > > work if foo.sage is there isn't really an option, since Python 
> > > > > directly
> > > > > does the import, and won't know to look for foo.sage.
>
> > > > > William

Actually, it is quite possible to modify the operation of import.
Behind the scenes, import looks up __builtins__.__import__ and calls
it; if you assign a new function to this variable, then it will be
responsible for looking up and loading the specified module.  The
standard Python module ihooks has tools to help write new __import__
functions.

(But I also like the idea of "attach foo.py as foo", for the
combination of "load into a namespace" and "auto-reload if the file
changes".)

Carl


--~--~---------~--~----~------------~-------~--~----~
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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to