Skip to content
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

Turn numpy warnings into numpy errors? #529

Open
hsl-petrhaj opened this issue Jun 29, 2023 · 1 comment
Open

Turn numpy warnings into numpy errors? #529

hsl-petrhaj opened this issue Jun 29, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@hsl-petrhaj
Copy link
Contributor

@johpiip @zptro
Do you think it makes sense to introduce the following line that promotes numpy errors from warnings to errors?
I think it is very strange that the program continues even after dividing by zero for example.

This continues like nothing has happenned:

import numpy as np
a = np.array([1,2,3]) 
b = np.array([0,0,0])
c = a/b

This throws an error:

import numpy as np
np.seterr(all='raise')

a = np.array([1,2,3]) 
b = np.array([0,0,0])
c = a/b

Of course that would push us to pay more attention to numpy warnings which could also be somewhat annoying. But, safety first?

@hsl-petrhaj hsl-petrhaj self-assigned this Jun 29, 2023
@hsl-petrhaj hsl-petrhaj added the enhancement New feature or request label Jun 29, 2023
@johpiip
Copy link
Contributor

johpiip commented Aug 17, 2023

Sounds like a good idea to me! You should test it first with our official scenarios that they do not raise errors - and if they do, we should think how to fix them first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants