#11441: Can't inherit from a lazy imported class
-----------------------+----------------------------------------------------
Reporter: nthiery | Owner: jason
Type: defect | Status: new
Priority: major | Milestone: sage-4.7.1
Component: misc | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
-----------------------+----------------------------------------------------
Currently, one can't inherit from a lazy imported class::
{{{
sage: class sage_X: pass
sage: sage.X = sage_X
sage: lazy_import("sage", "X")
sage: type(X)
<type 'sage.misc.lazy_import.LazyImport'>
sage: class Y(X): pass
....:
sage: Y
------------------------------------------------------------
Traceback (most recent call last):
...
File "lazy_import.pyx", line 213, in
sage.misc.lazy_import.LazyImport.__repr__ (sage/misc/lazy_import.c:1492)
File "lazy_import.pyx", line 110, in
sage.misc.lazy_import.LazyImport._get_object
(sage/misc/lazy_import.c:1011)
ImportError: No module named Y
}}}
As such, this feature is not necessarily that useful, but I had a
concrete use case where X was imported from a module which in turn
lazy imported from somewhere else (to provide a backward compatibility
link).
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11441>
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.