You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was originated from a discussion on pull request #4434.
External resources
This is what the Blank Lines section from the PEP 8 proposes:
Surround top-level function and class definitions with two blank lines.
Method definitions inside a class are surrounded by a single blank line.
Extra blank lines may be used (sparingly) to separate groups of related functions. Blank lines may be omitted between a bunch of related one-liners (e.g. a set of dummy implementations).
Use blank lines in functions, sparingly, to indicate logical sections.
Python accepts the control-L (i.e. ^L) form feed character as whitespace; Many tools treat these characters as page separators, so you may use them to separate pages of related sections of your file. Note, some editors and web-based code viewers may not recognize control-L as a form feed and will show another glyph in its place.
In the same line as PEP 8, Google's Python Style Guide also only mentions top-level function and class definitions:
Two blank lines between top-level definitions, be they function or class definitions. One blank line between method definitions and between the class line and the first method. No blank line following a def line. Use single blank lines as you judge appropriate within functions or methods.
Our usage
Let's take the logger variable definition, something very common across Python projects, as an example.
In Scrapy, we have some differences (both valid according to PEP 8):
What I'm trying to say is that there's no reference to this convention on the Scrapy's Coding Style, and IMO it's quite subjective.
TL; DR;
If this is important for the project to the point that we need to enforce it during code reviews, I propose we implement automatic code checks with a linter or at least document it in the Scrapy's Coding Style for future reference.
What do you think?
The text was updated successfully, but these errors were encountered:
This issue was originated from a discussion on pull request #4434.
External resources
This is what the Blank Lines section from the PEP 8 proposes:
In the same line as PEP 8, Google's Python Style Guide also only mentions top-level function and class definitions:
Our usage
Let's take the
logger
variable definition, something very common across Python projects, as an example.In Scrapy, we have some differences (both valid according to PEP 8):
Apparently, Django is using only one blank line in this case.
Bottom line
What I'm trying to say is that there's no reference to this convention on the Scrapy's Coding Style, and IMO it's quite subjective.
TL; DR;
If this is important for the project to the point that we need to enforce it during code reviews, I propose we implement automatic code checks with a linter or at least document it in the Scrapy's Coding Style for future reference.
What do you think?
The text was updated successfully, but these errors were encountered: