Ask Your Question
0

Sagecell kwargs no longer works

asked 2012-07-31 16:24:00 +0100

anonymous user

Anonymous

updated 2012-07-31 16:42:06 +0100

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 16:48:35 +0100 )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-03 02:26:19 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-07-31 17:30:35 +0100

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 11:21:03 +0100

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 16:24:00 +0100

Seen: 458 times

Last updated: Aug 01 '12