You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PEP 484 and PEP 526 added optional type hints to Python. We can use this in combination with mypy. I believe this can help catching bugs and also make the code easier to read. We don't have to add this everywhere at once, but can do so gradually. All code stays valid Python so there is no need to make use of mypy.
Right now often I check the docstrings to see which types arguments are supposed to be. Of course this is not necessarily correct. If we use the sphinx-autodoc-typehints extension we can make sure the type hints only have to be specified once, can be checked, and still end up in the documentation.
Great, I've been thinking about this as well. It wasn't worth it without xarray support, I figured, since so many functions take DataArrays; good to know it's been added.
In GitLab by @visr on May 20, 2019, 11:30
PEP 484 and PEP 526 added optional type hints to Python. We can use this in combination with mypy. I believe this can help catching bugs and also make the code easier to read. We don't have to add this everywhere at once, but can do so gradually. All code stays valid Python so there is no need to make use of mypy.
Right now often I check the docstrings to see which types arguments are supposed to be. Of course this is not necessarily correct. If we use the sphinx-autodoc-typehints extension we can make sure the type hints only have to be specified once, can be checked, and still end up in the documentation.
xarray added support for mypy recently as well: pydata/xarray#2655
The text was updated successfully, but these errors were encountered: