Open Risitop opened 2 months ago
Thanks for posting this. Is it on purpose that the final implementation is untyped? Does your linter/typechecker know the type of x and enforce the return type in the last implementation function?
Indeed, this pattern allows the typechecker to pick the signature that matches the arguments type in order to infer the correct return type :)
Pydocstest does not seem to be able to handle
@typing.overload
-ed functions right now. According to Ruff, only the actual implementation should be endowed with a docstring:https://docs.astral.sh/ruff/rules/overload-with-docstring/
Currently, pydoctest does not seem to be able to handle this case:
$ pydoctest --parser numpy
-> /test.py::timestwo FAIL | Return type differ. Expected (from signature) <class 'inspect._empty'>, but got (in docs) int | float.
I think that given the tool logic, those multi-definition cases will be hard to handle. In the case it would be too difficult, I think being able to ignore checking for a specific docstring with a kind of
# nopydoctest
option would be acceptable for these rare occurences.Thanks!