Operating system: playground
Python version: playground
Black version: master
Consider following code snippet:
class X:
def f(self, x):
return x**2
When class definition is formatted, empty lines between class X: line and first node of the body is forced to be zero.
When function definition is formatted, empty lines between def f(): line and first node of the body is normalised to either 0 (if input code had 0 empty lines) or 1 (if input code had 1+ empty lines).
While it's preferable to preserve some of the empty lines of input code, doing this for leading empty lines of node body makes no sense, as this empty line cannot have any mental meaning in such context.
Operating system: playground
Python version: playground
Black version: master
Consider following code snippet:
When class definition is formatted, empty lines between
class X:line and first node of the body is forced to be zero.When function definition is formatted, empty lines between
def f():line and first node of the body is normalised to either 0 (if input code had 0 empty lines) or 1 (if input code had 1+ empty lines).While it's preferable to preserve some of the empty lines of input code, doing this for leading empty lines of node body makes no sense, as this empty line cannot have any mental meaning in such context.