-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
set_option as a context manager #5618
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
Comments
you have to do something like:
IIRC |
Oh nice. Is it new? I don't see it in the namespace. Probably deserves a mention in the set_option docstring too. |
I think it's been around |
|
so you can with option_context(foo,"is1", bar, "is2"):
baz |
Ah, great. Then consider this a request for importing it into the top-level namespace and adding some docs. |
I have no objections to that. Can't remember the details but I think the reason set_option |
Thanks @jseabold. |
Running this in a Jupyter notebook shell does not print anythin:
but this does work as expected:
I expected to get the same result but I did not. Any ideas, why? Is it a problem on the Jupyter side or re the implementation of the context? Thanks. |
@oztalha wrap your |
Thanks, worked just as you said:
|
It doesn't look like it's available yet as such, but it might be nice to have set_option usable as a context manager. E.g., I often find myself wanting to do something like
As simple as adding
__enter__
and__exit__
methods and preserving state?The text was updated successfully, but these errors were encountered: