#14722: Add at_startup flag to lazy_import
---------------------------+------------------------------------------------
   Reporter:  nthiery      |             Owner:  jason            
       Type:  enhancement  |            Status:  new              
   Priority:  major        |         Milestone:  sage-5.11        
  Component:  misc         |          Keywords:                   
Work issues:               |   Report Upstream:  N/A              
  Reviewers:               |           Authors:  Nicolas M. ThiƩry
  Merged in:               |      Dependencies:                   
   Stopgaps:               |  
---------------------------+------------------------------------------------
 Lazy imports have two main use cases:
 (a) Delaying imports that are not always needed for a faster Sage startup
 (b) Resolving import loops

 This ticket introduce an option "at_startup" to allow for lazy imports
 that are known to be resolved at startup time. The main use case is
 (b) in the context of #10963. E.g. the categories Magmas and
 Semigroups import each other reciprocally (because Magmas.Associative
 points to Semigroups). It is natural to resolve this by defining
 Magmas.Associative using a lazy import; one can then play with
 Magmas() without having to load Semigroups. However Semigroups() is
 later constructed during Sage's startup (and this is unlikely to
 change).

 This option could also be used as an intermediate step toward (a),
 when a module is used in several places and some of those places can
 already afford to lazy import the module but not yet others. As a
 bonus, a lazy import that is marked as "at_startup" will print a
 message if it is actually resolved after the startup, so that the
 developer know that (s)he can remove the flag.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14722>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to