Skip to content

PyCharm warnings on numeric operations #771

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
max-sixty opened this issue Feb 19, 2016 · 1 comment · Fixed by #773
Closed

PyCharm warnings on numeric operations #771

max-sixty opened this issue Feb 19, 2016 · 1 comment · Fixed by #773

Comments

@max-sixty
Copy link
Collaborator

Currently PyCharm warns if a numeric operation is performed on an xarray object. We could suppress these by:

  • Adding __add__ = NotImplemented onto the BaseDataObject (and all the other ops from CMP_BINARY_OPS & NUM_BINARY_OPS), so IDEs know about them
  • Adding a set of skeletons here: https://github.com/JetBrains/python-skeletons. I haven't tried this, and the readme looks out of date. But it does seem to work for numpy objects
  • Wait for IDEs to be able to recognize the monkey patching that is done here (not my preference)
@shoyer
Copy link
Member

shoyer commented Feb 19, 2016

I'd be happy with the first option, although I'd rather we use a function that actually gives a sensible error message, i.e.,

def _not_implemented(*args):
    return NotImplemented
__add__ = _not_implemented

This does seem to be a point in favor of doing something more explicit rather than injecting numeric operations.

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

Successfully merging a pull request may close this issue.

2 participants