-
Notifications
You must be signed in to change notification settings - Fork 6
Use type hints for returned objects #864
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
Comments
It is a good idea to at least experiment with this but I wonder how to avoid duplication with what we have in the docstrings. Do you have an example of project using numpydoc style docstrings also using type hints? Assuming we go down that path (this needs a bit of research before we decide), I wonder what is the best strategy: all at once (a very large task) or as we go. |
The idea behind is to (as for the arr = ndtest((3, 3)).transpose()
arr. PyCharm doesn't know that the tranpose() method returns an array and then writing In other words, I am mostly interested to specify the type of the returned object by a method than to specify the type of each argument.
xarray partly does (for the returned type ;) ): https://github.com/pydata/xarray/blob/c788ee44008cdd65c8b6de40c737f1b28e173496/xarray/core/variable.py#L65 I don't know about pandas but they have a typing.py module.
We can start with the type of the returned object if there is one. In that case, I can try to do it for all functions and methods. |
Ok, I missed that relatively recent development of things. It seems like the community is moving towards type hints in addition to numpydoc style docstrings. As you say, the return type is the most important and less verbose change, so we can start with that. |
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods.
…unctions and methods. fix larray-project#867 : adapted code and configuration files to use mypy
…unctions and methods. fix larray-project#867 : adapted code and configuration files to use mypy
…unctions and methods. fix larray-project#867 : adapted code and configuration files to use mypy
…turned type of the decorated function (issue larray-project#864)
…turned type of the decorated function (issue larray-project#864)
…turned type of the decorated function (issue #864)
…ic functions/methods
…turned type of the decorated function (issue larray-project#864)
…ic functions/methods
Now we officially do no longer support Python versions under 3.6, it is (maybe) the right time to introduce type hints the code of LArray.
The text was updated successfully, but these errors were encountered: