Ask Your Question
0

Sagecell kwargs no longer works

asked 2012-07-31 09:24:00 -0500

anonymous user

Anonymous

updated 2012-07-31 09:42:06 -0500

kcrisman gravatar image

A week or so ago, I spent quite a lot of time with some sagecell code, but it no longer seems to work.

In particular, if I ran the following code on aleph:

@interact
def f(denominator=2):
    print "denominator must be an even integer"
    assert type(denominator) == Integer
    assert denominator % 2 == 0
    @interact(controls=[('t', (-1/2,1,1/denominator))])
    def s(multiplier=2, **kwargs):
        assert multiplier > 0
        print kwargs.keys()

I would now get an empty list, whereas a week or 10 days ago, I got 't'. As a result, my code is now irretrievably broken.

What changed and how can I either fix it or restore the old version?

edit retag flag offensive close merge delete

Comments

I'm sure Alex or Jason or one of the other Sage cell developers will address this, but my gut is that you are really using undocumented behavior with the `**kwargs` bit there - I'm sure that they are still working out bugs with nested interacts. I did see a couple of commits on github that seemed perhaps connected.

kcrisman gravatar imagekcrisman ( 2012-07-31 09:48:35 -0500 )edit

This works now, thanks to this pull request from Ira Hanson: https://github.com/sagemath/sagecell/pull/353

Jason Grout gravatar imageJason Grout ( 2012-08-02 19:26:19 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2012-07-31 10:30:35 -0500

Alex Kramer gravatar image

I thinkthis is an issue related to a change we made regarding how defining controls in the interact decorator works. I've opened an issue about that behavior here: https://github.com/sagemath/sagecell/...

In the meantime, since t is being defined in the function globals, you can access it from there (or just by the variable t). One thing you might want to do for now to ensure consistent behavior with local variables and kwargs for the function is to either define all interacted variables in the interact decorator or define all interacted variables in the function itself until the issue is resolved.

edit flag offensive delete link more
0

answered 2012-08-01 04:21:03 -0500

Jason Grout gravatar image

Alex is correct; there was a change in the new experimental options dealing with defining controls in the interactpart. We (on the sagecell dev team) talked about this a few weeks ago, and we realized that this change has unintended consequences, so we'll be changing it back. For now, you can use aleph1.sagemath.org (which uses our code from last year).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-07-31 09:24:00 -0500

Seen: 123 times

Last updated: Aug 01 '12