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

E302 doesn't reginise commments with ''' comment '''

tsalehm opened this issue · comments

hi. E302 doesn't reginise commments with ''' comment ''' and """ comment """

versionpath = r'%appdata%\DesktopGoose\pylauncher\files\version.txt'


'''functions'''
def check_for_updates():

(expected 2 blank lines, found 0)

if I replace '''functions''' with #functions I wouldn't get the error

@jayvdb @asottile
Originally posted by @tsalehm in #412 (comment)

that's not a comment -- that's just a floating string literal

floating string literal

@asottile
so using it a a comment is stupid right?

I wouldn't go as far to say "stupid" but yeah it's not a comment. if it's at the top of the file / class / function it's a docstring -- otherwise it's a floating expression (same as putting like 5 on its own) and looks like a mistake

To be fair, old (Python 2.5, 2.6 if I remember correctly) docs say you could use a multi-line string as a multi-line comment in the sense of C-like languages that have /*...*/ style multi-line comments but that is still a multi-line docstring, not a comment. I don't think pycodestyle should grow in complexity to try to recognize it either because it would lead to too many false negatives in my opinion. It's not a widespread well-recognized practice either in my estimation