Is this even possible?
Given code
@interact
def _(widget_1=...,widget_2=..,...):
do some stuff
is it possible to somehow extract the first version that is displayed,
with the defaults?
Simple example:
@interact
def _(x=2):
print x^2
I want the output
4
Harder example:
@interact
def _(f=x^2, a=(3,[2..10]), c = (2,6)):
g(x)=f+a
show(plot(g,(x,-c,c)))
I want the plot of x^2+3 from -2 to 2. Or the code for a function
which would do that, but has the correct defaults.
The best would be for a "magic" substitution of defaults into a new
function
def _():
g(x)=x^2+3
show(plot(g,(x,-2,2)))
but anything even approaching that would be great. I figure that the
interact code must do this at some level, but I can't figure it out,
because there are so many decorators floating around creating the
thing that gets passed to the web page...
Thank you!
- kcrisman
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org