Hi Robert! On Mar 5, 12:42 am, Robert Bradshaw <rober...@math.washington.edu> wrote: [...] > > As soon as anything is done with the object, it > > does a *real* import, replaces itself in G with the real thing, and > > since the reference from G is gone, the LazyImport object would > > eventually be garbage collected. > > I've actually intended to do this as well, it'd be easy, but I just > haven't had time to do it. Note, however, that this is not transitive, > so the lazy objects may still be around.
You mean, if you have sage: imp = LazyImport(globals(),'QQ','sage.rings.rational_field','MyQQ') then "imp" would remain lazy even if at some point it injects QQ into globals()? Sure, this would be difficult to circumvent, but that way of usage is certainly discouraged. > (This is less of an issue for > the global namespace, but if someone does "from sage.all import foo" > they'll have the lazy version forever.) Why? If you start with a lazy import of "foo" then foo will be a LazyImport object, to start with. If you then do "from sage.all import foo" then the reference "foo" to the LazyImport object is replaced by a reference to what was just imported; as there is no pointer to the LazyImport object, garbage collection will work. > There's some other > improvements that I'd like to make too. You willing to referee a patch > in this direction? :) Sure! Where is the ticket? Best regards, 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