-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Questionable "bad-whitespace" for function annotations with default values #238
Comments
1 |
https://www.python.org/dev/peps/pep-0008/#other-recommendations
|
Adressed in #1229 |
Thanks @petrpulc |
Hello again. import datetime
def foo(date: datetime.date = None) which will now still result in bad-whitespace. While the "regular" type hints work now (yet are not checked against imported names), this is virtually uncheckable. Should I resign and add the period as an ignored token; or would it be even better to not check the contents of the annotation at all? |
Originally reported by: Antony Lee (BitBucket: anntzer, GitHub: @anntzer?)
Both http://legacy.python.org/dev/peps/pep-3107/ and https://docs.python.org/3/tutorial/controlflow.html#function-annotations put spaces around the
=
for default values when an argument has an annotation:I also think that the second option looks weird as I tend to parse it as
x: (int=1)
, not(x: int) = 1
. Well, perhaps the syntax could have been better but that's what we have now.But Pylint currently triggers a bad-whitespace warning for the first option.
The text was updated successfully, but these errors were encountered: