pythonformatautopep8

Why does VS-Code Autopep8 format 2 white lines?


print("Hello")

def world():
    print("Hello")

world()

Gets corrected to:

print("Hello")


def world():
    print("Hello")


world()

I have tried to:


Solution

  • Because autopep8 follows PEP8 which suggests 2 blank lines around top-level functions.

    Surround top-level function and class definitions with two blank lines.