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

Comparison to None in Numpy 1.9 #64

Closed
olaurino opened this issue Jul 9, 2015 · 0 comments
Closed

Comparison to None in Numpy 1.9 #64

olaurino opened this issue Jul 9, 2015 · 0 comments

Comments

@olaurino
Copy link
Member

olaurino commented Jul 9, 2015

Since the Numpy 1.9 upgrade, users have been reporting warning messages like the following:

FutureWarning: comparison to None will result in an elementwise object comparison in the future.

Generally speaking, it is good practice to do None checks with if var is None rather than if var == None because the equality check can be (at least in principle) overridden. Which is what some of the Numpy structures do or are going to do in the future.

The issue is usually easy to fix, but getting a list of these warnings is not easy. We did fix some of them in the past (see 61fbfcd) but more have been reported, in particular:

sherpa/astro/io/crates_backend.py:1224
sherpa/sim/sample.py:184
sherpa/astro/ui/utils.py:8763
sherpa/astro/ui/utils.py:8768

For what is worth, a workaround exists:

import warnings
warnings.filterwarnings('ignore', category=FutureWarning)
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

1 participant