Ticket #10622 (needs_work enhancement)
import sage.all.* into the interact library
| Reported by: | jason | Owned by: | itolkov, jason |
|---|---|---|---|
| Priority: | major | Milestone: | sage-5.11 |
| Component: | interact | Keywords: | |
| Cc: | mhampton | Work issues: | |
| Report Upstream: | N/A | Reviewers: | |
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
This patch:
diff -r 553928e53141 sage/interacts/library.py
--- a/sage/interacts/library.py Mon Jan 10 10:03:25 2011 +0100
+++ b/sage/interacts/library.py Thu Jan 13 09:01:40 2011 -0800
@@ -3,9 +3,9 @@
"""
from sagenb.notebook.interact import interact, slider, range_slider, input_box
-from sage.all import sin, plot, point, html, show, latex, SR,exp
-x=SR.var('x')
-
+from sage.all import *
+x=var('x')
+
from sage.misc.decorators import sage_wraps
from sage.misc.html import html
makes it *much* easier to move interacts to the library since you don't have to define every single thing you use from the sage library.
Change History
comment:2 Changed 2 years ago by mhampton
I'll try to fold this into #9623 and test the result. It would be cool if it works. I tried to add that import to the decorator but couldn't get it to work.
comment:3 Changed 2 years ago by mhampton
This seems to work remarkably well. I will refactor #9623 accordingly. I would like to do these together to avoid merge annoyances.
comment:4 Changed 2 years ago by jason
Yes, I hit a limitation in Python when I tried to import * in the decorator. A quick search led to several emails by Guido et. al. in 2001 about this being a problem or something.
Anyways, import * at the module namespace works. It just means that people better not try to tab-complete on interacts.library.<tab>, since it will give the entire Sage namespace, I believe!

I'm a little surprised that there aren't circular import problems here, so this should definitely be tested. If it works, it's a big win for making interacts easier to port to the library.
Marshall, can you test this and turn it into a real patch?