8000 ENH: make `printoptions` a true context var · Issue #26314 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: make printoptions a true context var #26314

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
mtsokol opened this issue Apr 19, 2024 · 3 comments
Closed

ENH: make printoptions a true context var #26314

mtsokol opened this issue Apr 19, 2024 · 3 comments
Assignees

Comments

@mtsokol
Copy link
Member
mtsokol commented Apr 19, 2024

Proposed new feature or change:

Hi!

One of possible enhancements is to make printoptions use a context var. Right now it uses a _format_options dict defined in the arrayprint module - context var will give context-local state.

WDYT?

@mtsokol mtsokol self-assigned this Apr 19, 2024
@ngoldbaum
Copy link
Member

Yikes! I guess the current implementation isn't thread-safe then.

Do we want to allow thread-local print options? That seems strange to me. Better to make it like the errstate and make it a global setting that can only be entered once.

@seberg
Copy link
Member
seberg commented Apr 22, 2024

Heh, I thought there was an old issue about this somewhere, but didn't find it. In any case: any context manager should be backed by one (or maybe more) context variables to make sure it is truly context safe. And I would expect that to make the code a bit nicer as well.

@mtsokol
Copy link
Member Author
mtsokol commented Jul 28, 2024

Resolved in #26846

@mtsokol mtsokol closed this as completed Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0