-
Notifications
You must be signed in to change notification settings - Fork 234
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
What if a function has argument types but no return type? #37
Comments
I think 1 sounds good. What if some of the arguments are not annotated? |
I always assumed this would be (1), because "unannotated" means "Any" in On Thu, Jan 15, 2015 at 7:16 AM, Andrey Vlasovskikh <
--Guido van Rossum (python.org/~guido) |
Okay, 1 is reasonable and how it currently works in mypy. Maybe the examples in the PEP should be modified to include the return value type, even if it's |
Agreed, the PEP should only show fully-annotated examples, except where explaining what leaving out annotations means. |
Looks like a duplicate of #65 |
The PEP draft has an example where there are argument type annotations but no return type annotation. What does it mean? Mypy currently treats the return type in a case like this as
Any
, but this is probably confusing, and it's easy to forget to give a return type. Maybe this should be disallowed?For example, should this code be valid:
There at least 4 potential approaches:
Any
.None
.I'm inclined to support 3. I'm against 2 (because of inconsistency for functions which take no arguments, which must have an explicit
None
return type as otherwise they don't have an annotation at all) and 4 (explicit is better than implicit, implementation complexity).The text was updated successfully, but these errors were encountered: