#19628: lazy_import breaks CachedRepresentation
----------------------------+-------------------------
       Reporter:  cheuberg  |        Owner:
           Type:  defect    |       Status:  new
       Priority:  major     |    Milestone:  sage-6.10
      Component:  coercion  |   Resolution:
       Keywords:            |    Merged in:
        Authors:            |    Reviewers:
Report Upstream:  N/A       |  Work issues:
         Branch:            |       Commit:
   Dependencies:            |     Stopgaps:
----------------------------+-------------------------

Comment (by nbruin):

 Replying to [comment:30 jdemeyer]:
 > So, what's your proposal then? Close this ticket as wontfix and change
 the lazy_import of `NN` (and similar objects) to a "real" import?

 Yes. Or if NN is too expensive to import at startup, adapt the places
 where NN is accessed (the count above shows about 10 modules (including
 `__main__` and I think some double counting) that reference it via a lazy
 import) in a way that triggers the import as soon as NN is accessed (i.e.,
 either by accessing NN through a namespace that's lazily imported or via
 an accessor function). I don't see a reasonable alternative while
 maintaining a semantics model that at least resembles that of python.

 The other thing we should do is clean up the mess of mis-lazy_imported
 objects. As the list above shows, a lot of lazy_imports don't have a
 chance of ever clearing themselves up. The penalty of accessing an object
 through a lazy_import isn't that high, but the problem is these things
 compound. We already have lazy_imports that point to lazy_imports.

 I propose:
  - adding a function that gives access to the lazy_import cdef attributes
 (probably just by returning a dict that has their values)
  - including a doctest that tests if lazy_import objects in sys.modules
 dicts reference their own scope.

 but perhaps that's better handled on a different ticket.

--
Ticket URL: <http://trac.sagemath.org/ticket/19628#comment:31>
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to