-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Black should not change leading white space in doc strings #1698
Comments
Protesting reformatting of parser grammar (see psf/black#1698). Rest is fine.
I don't agree. If you want formatting like that, i would advice on using a dot or backslash on the "zeroth" space, so it doesn't indent |
Can you or someone offer an explanation of why Black disregards PEP 257?
Emphasis is mine. In the case of my example, the doc string is a grammar. I don't have the luxury of making up a syntax to workaround Black's decision to reformat the doc string. Similarly, someone using reStructuredText, a standard use of doc string, does not have the luxury of making up a new syntax based on your workaround suggestion. Leading white space is meaningful in both cases. It's meaningful for Markdown. Black is not only violating Python standards here it's breaking common use of doc string. Do you disagree with that? |
I regres. You are correct. |
Black 20 is now changing this:
to:
Doc strings can be used for formatted text including, well, anything you want. In this case the doc strings are used by PLY to define a parsing grammar. This issue will effect anything that uses leading white space such as Markdown. It's bad form to start mucking with prose. You have no idea what's in there. White space that starts and ends the comment is fair game but not the content in between.
The text was updated successfully, but these errors were encountered: