Skip to content

The method to undo numpy set_printoptions #8344

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

Closed
kyruzic opened this issue Dec 5, 2016 · 1 comment · Fixed by #10406
Closed

The method to undo numpy set_printoptions #8344

kyruzic opened this issue Dec 5, 2016 · 1 comment · Fixed by #10406

Comments

@kyruzic
Copy link

kyruzic commented Dec 5, 2016

In order to undo what ever print options I have set I need to call a function with a massive number of arguments. Why isn't there an argument like default=False and then if I call it with default=True I get back to the original print options. This doesn't have much of an impact in regular programs but it does have a huge impact in jupyter notebooks! A huge amount of computational physics teaching is shifting to these and it is so frustrating to have to have such an ugly line of code for absolutely no reason when it could be fixed in the simplest way.

This is taken directly from numpys documentation
np.set_printoptions(edgeitems=3,infstr='inf',
... linewidth=75, nanstr='nan', precision=8,
... suppress=False, threshold=1000, formatter=None)

@charris
Copy link
Member

charris commented Dec 5, 2016

There has been a proposal for a printoptions context manager, see #3987. Man, that is already three years old...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants