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
Removed adding a space into empty docstrings. #2249
Conversation
Thanks, I agree we should do this. Can we still make it output a single space if the original docspace is nonempty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. With the change to preserve docstrings that already contain a space, this shouldn't cause thrash for people who applied the formatting from the current release, while preserving completely empty docstrings for those who need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything wrong with this and this is a good pragmatic change. Thanks!
Does this mean if I reformatted the code with the previous |
Yes. It's not great for docstrings that were erroneously (like for sphinx docs) changed to |
Resolves #2168 by disabling the insertion of a " " when the docstring is entirely empty.
Note that this PR is focussed only on the case of empty docstrings. In particular this does not make any changes to the behaviour that a " " is inserted if a non-empty docstring begins with the quoting character. That is, black still prefers:
to:
and that:
is not a legal docstring.