#11762: More import cleanup
---------------------------+------------------------------------------------
   Reporter:  robertwb     |          Owner:  jason          
       Type:  enhancement  |         Status:  needs_review   
   Priority:  major        |      Milestone:  sage-4.7.2     
  Component:  misc         |       Keywords:                 
Work_issues:               |       Upstream:  N/A            
   Reviewer:               |         Author:  Robert Bradshaw
     Merged:               |   Dependencies:                 
---------------------------+------------------------------------------------

Comment(by robertwb):

 Sorry I didn't see your comment earlier.

 Basically, when you do {{{import a.b.c}}} it first loads
 {{{a/__init__.py}}}, then {{{a/b/__init__.py}}}, and finally
 {{{a/b/c.py}}} (or {{{a/b/c/__init__.py}}}).

 Importing {{{all}}} imposes no restraint, so one can {{{import
 sage.rings.foo.fragile_module}}} without loading {{{sage.ring.all}}}. If
 {{{fragile_module}}} depends on {{{stable_module}}} being loaded first,
 then {{{sage.rings.all}}} can enforce this order, but only if
 {{{sage.rings.all}}} is loaded before {{{import
 sage.rings.foo.fragile_module}}}. Even when things aren't fragile, this
 ensures that the submodules of sage.rings get loaded in the order
 specified in all.py, greatly reducing the chance that a change in imports
 in an unrelated portion of code can trigger a chain reaction, import
 things in a different order, and have result in circular import errors.
 This will also help with performance, as one can see the actual load time
 of sage.rings.all without wondering about how many submodules were
 "preloaded." So it's both a cleanup and a prelude to further cleanup.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11762#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
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-trac?hl=en.

Reply via email to