Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

PEP 8 whitespace handling #21

Open
taion opened this issue Jan 14, 2018 · 4 comments
Open

PEP 8 whitespace handling #21

taion opened this issue Jan 14, 2018 · 4 comments

Comments

@taion
Copy link
Contributor

taion commented Jan 14, 2018

The whitespace handling in PEP 8 is a little different. Two cases stand out to me as unhandled.

Two spaces before inline comments

Current:

foo() # This is a comment.

Desired:

bar()  # This is a comment.

Two newlines between functions and classes at indent level 0

Current:

def foo():
    pass

def bar():
    pass

Desired:

def foo():
    pass


def bar():
    pass
@jleclanche
Copy link

jleclanche commented Mar 16, 2018

One more: Missing whitespace at the end of single-item tuples:

Input (desired):

example = ("foo", )

Output:

example = ("foo",)

Edit: Nevermind, I remembered pep8 wrong.

@jleclanche
Copy link

Found another: missing spaces after commas in class parents:

Input (desired):

class MyClass(type1, type2):
	pass

Output:

class MyClass(type1,type2):
	pass

@taion
Copy link
Contributor Author

taion commented Mar 16, 2018

PEP 8 explicitly enjoins against the space between the comma and the closing paren on single-element tuples: https://www.python.org/dev/peps/pep-0008/#pet-peeves

This is one of many inane YAPF-isms.

@jleclanche
Copy link

Huh, okay, never noticed that since flake8 doesn't complain about it. Nevermind that one then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants