google / google/yapf

Adjustable blank lines between class methods

Open
#931 2 comments 11 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

I think the `BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF=True` controls this... but it's just a True/False option. I tend to prefer 3 blank lines before a class definition and then 2 blank lines between methods within it (save, for the first method which I'm fine with having on the next line after the docstring)... something like:

```python
import foo
import bar

class myclass(object):
"""
docstring...
"""
def __init__(self):
# init stuff

def foo(self):
# stuff
return
```

Is there a way to achieve this? If not, would it be possible to get a new option that could set the # of blank lines before class methods? Maybe add the ability for `BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF` to be T/F or an integer >= 1?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.