> f() # gives 4
>
> f(3) # gives 9
>
> The original function is left intact, so you can just call it.

Hmm, I didn't realize that would work so easily.  I must have been so
blown away by the interact return value that it didn't occur to me to
try this :)

> > Harder example:
>
> > @interact
> > def _(f=x^2, a=(3,[2..10]), c = (2,6)):
> >       g(x)=f+a
> >       show(plot(g,(x,-c,c)))
>
> This is harder since when the interact is run, ``a`` is a single number
> (by the autoguessing), but when the function itself is run, ``a`` is a
> tuple.  Same problem for c.  Maybe we should actually change the
> function that is returned to substitute in the default arguments,
> instead of just returning the function.  That would be doable and
> reasonable, I think.

That would be very nice, since then the function one gets is actually
more usable, if one needed that.

But is there any *current* way to get at this?  My guess is no,
because the code for the "autoguessing", if that was what I was
looking at, is fairly detailed to cover all the cases.   But it would
be really useful.

- 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

Reply via email to