PyCQA / pycodestyle

Simple Python style checker in one Python file

Home Page:https://pycodestyle.pycqa.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

blank lines and form feed (^L)

tungol opened this issue · comments

Hi,

I'm interested in the (somewhat obscure) use of the form feed character in python source code, which has semantic meaning for some editors. Pycodestyle allows this usage, and currently counts a line that consists only of a ^L character as a blank line.

The character was previously used in some files in the standard library. It's since been removed in all cases, but I'm looking to that for precedent. It appears that historical usage of the form feed character in cpython source code was to place ^L on its own line, which was in addition to the two truly blank lines. You can see that highlighted in this MR.

Looking to PEP 8 itself, it's a little ambiguous as to whether a line with a form feed character counts as a blank line or not. Form feeds are discussed under the "blank lines" section, which implies they count, but it's not really specified one way or another.

All that in mind, I'd like to propose that ^L on a line by itself not be counted as a blank line for the purposes of E303 "too many blank lines". If I were to create an MR to that effect, would it be likely to be accepted?

I would strongly recommend against using obscure characters like ^L -- cpython removed them because they were misleading / obscure

pycodestyle should not encourage their use by adding special support for them

Thanks for the quick response, sounds good.