#12543: improve import_statements
--------------------------------------------------+-------------------------
Reporter: aschilling | Owner:
sage-combinat
Type: enhancement | Status:
positive_review
Priority: major | Milestone: sage-5.8
Component: misc | Resolution:
Keywords: import_statements, development | Work issues:
Report Upstream: N/A | Reviewers: Nicolas M.
Thiéry
Authors: Vincent Delecroix | Merged in:
Dependencies: | Stopgaps:
--------------------------------------------------+-------------------------
Changes (by nthiery):
* status: needs_review => positive_review
* reviewer: => Nicolas M. Thiéry
Old description:
> Currently, import_statements yields a name error if the class is not yet
> imported. For example
>
> {{{
> sage: import_statements(ClonableIntArray)
> NameError: name 'ClonableIntArray' is not defined
> }}}
>
> It would be desirable to have import_statements run a search_def in case
> the object is not imported by default in the interpreter. This would
> require passing the name of the object as:
>
> {{{
> sage: import_statements("ClonableIntArray")
> }}}
>
> The patch improve import_statements by looking through SAGE modules in
> order to find an appropriate import. See the documentation for examples.
New description:
Currently, import_statements yields a name error if the class is not
imported in the Sage interpreter namespace. For example.
{{{
sage: import_statements(ClonableIntArray)
NameError: name 'ClonableIntArray' is not defined
}}}
With this patch, one can specify the object as a string, and the object
is looked up in all (imported) Sage modules.
{{{
sage: import_statements("ClonableIntArray")
}}}
See the documentation for more examples.
This patch implements several heuristics to better handle ambiguous
names.
--
Comment:
I did some improvements with Vincent watching over my shoulder.
Positive review! Thanks Vincent :-)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12543#comment:3>
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.