pythonpep8

Python PEP8: Blank lines convention


I am interested in knowing what is the Python convention for newlines between the program parts? For example, consider this:

import os

def func1():

def func2():

What should be the ideal newline separation between:

  1. The import modules and the functions?
  2. The functions themselves?

I have read PEP8, but I wanted to confirm the above two points.


Solution

    1. Two blank lines between the import statements and other code.
    2. Two blank lines between top-level functions.