-
Notifications
You must be signed in to change notification settings - Fork 943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interactive: Add argument for suppressing result output. #712
Conversation
The flag can typically be used when the output is large, e.g. a numpy array.
How should parameters like these to |
Clear output should be documented in the interactive example notebook. What's your use case for this flag? |
I did not add the clear output flag, and I do not know what the use case for that flag is. If you are asking about the use case for the output_result flag, see the first comment above. |
I think the use of interact without output rendering is a little strange because it's not what interact was intended for. Interact was intended to be used to explore the input/output relationship of functions. General UIs are usually constructed "manually" by instantiating the widgets directly. That said, I don't see why this would hurt (other than API bloat / scope creep). I'll differ to @ellisonbg or @SylvainCorlay 's judgement for a 👍 or 👎 . As an aside, you should be able to accomplish a similar effect by wrapping your function in a lambda that returns nothing. |
I am not a good judge at all since not a big fan of the For a python beginner, My only objective with interact at the moment is to make it compatible with the API of sage so that sage's migration to ipywidgets is as easy as possible. |
I was looking for something like this... I hope it will be merged. |
I'm not commenting on whether this is a good idea or not, but if you do implement, it should be an option (see #771). |
Here's a situation where output isn't wanted: from ipywidgets import interact
def f(x,y):
print(x)
print(y)
return 'Huge printed output: %s'%(x+y)
interact(f, x=10, y=(1,20)) and here's a solution that uses the functools.wraps method: from functools import wraps
@interact(x=10, y=(1,20))
@wraps(f)
def myfun(**kwargs):
f(**kwargs) I'm on the fence whether we should encourage users to use something like the above workaround, or provide an option. Thoughts from @josteinbf? Edit: I think we only need |
7cf1b8b
to
d7fdae5
Compare
0a7fab4
to
c0fc921
Compare
I'm going to close this since the wrapping solution above has a smaller API surface and hews more closely to the ideas of the interact decorator. |
The flag can typically be used when the output is large, e.g. a numpy
array.