-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add implicit -> None type annotation to __init__ methods #389
Comments
What args are you passing to mypy? I am asking because I just compiled an example without an annotation and ran mypy with my standard set of mypy args, and I did not see a warning. My standard mypy args: '--ignore-missing-imports', '--python-version', '3.5', '--warn-incomplete-stub', '--warn-redundant-casts', '--warn-return-any', '--warn-unused-ignores' |
@ArneBachmann I can't reproduce this; can you give me some example code that replicates this error? |
I don't use any of those mypy options, but it seems to have gone away, was probably earlier a thing with Python 2 code compat problems, that made me make it a habit to mark every procedure with -> None. I recently decided to ditch all Python 2 support as it was really hard to achieve, even with Coconut. Just wasn't worth it anymore, especially since any reliable Python console app on Windows requires PEP528/529, supported only from Python 3.6 on (!). |
I have it again:
for
Any idea? |
|
That's not entirely correct. PEP 484 specifies that As you can see in this mypy issue, Guido himself complains that "... it'd suck if we'd have to develop the habit of adding explicit '-> None' to all init methods just to make mypy happy". But the issue is still an open bug with mypy, so for the time being, making mypy happy requires that you explicitly add the '-> None'. Hopefully in the near future, |
One possible solution to this is to have Coconut automatically annotate |
+1 since also class definitions may leave out the : pass part, similar how -> None could be left out. |
Per the above, this is probably not worth implementing. If someone wants a type-checked no-argument If someone didn't want their no-argument |
Should work fine with mypy even if not marked via
-> None:
(because it's implicit in Python terms)The text was updated successfully, but these errors were encountered: