Hi!

On Mar 4, 8:35 am, Robert Bradshaw <rober...@math.washington.edu>
wrote:
[...]
> I think we can have the names there without importing all the code  
> behind everything. With tab completion, a huge global namespace isn't  
> that bad.

How would this be possible, technically? I mean, is there a technical
solution that does not require python to be patched?

Perhaps modifying the sage preparser:
 - At startup, virtually nothing of sage.all is imported, but the
names of things in sage.all are known, and it is known where to import
them from. Let SageAllNames be a dictionary that associates the name
with the location for import.
 - The preparser could detect whether a given command line contains an
identifier N outside an import or assign statement, with N in
SageAllNames.keys(). If not globals().has_key(N), the preparser would
prepend "from %s import %s"%(SageAllNames[N],N) to the given command
line.
 - It would be easy to modify tab completion so that
SageAllNames.keys() is accessible to tab completion.

Would that be feasible?

I think it could reduce the startup time considerably. A user wouldn't
notice any change during an interactive session. And since it only
concerns the preparser, it would not break any code.

Cheers,
Simon

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to