samedi 16 juillet 2022

PEP8, blank line convention and reduced readability in dense code

Most of the time, PEP8 does not allow more than 1 blank line inside function or more than 2 blank lines between functions. When code is dense, even 2 blank lines can reduce readability.

Is there any guidance how to overcome this? Use some visual elements composed of ASCII characters?

def fun1():
    """
    This does x
    """

    ## Problem 1

    # Subproblem 1.1    
    ...

    # Subproblem 1.2
    ...

    ## -------------------
    ## Problem 2
    ...

# ------------------------
def fun2():
    """
    This does y
    """
    pass   

Aucun commentaire:

Enregistrer un commentaire