Skip to content

Adjusting to PEP8 Style for function with long list of parameters #2117

@nbievre

Description

@nbievre

Describe the style change:
Add an extra level of indentation in the list of arguments of functions with long list of arguments to respect the PEP8 style guidelines.

The PEP8 style guidelines suggests to "Add an extra level of indentation to distinguish arguments from the rest" of the function. However, the Black formatter does not add this extra level of indentation which makes less PEP8 compliant.

Examples in the current Black style :

def function_name(
    arg1: int,
    arg2: int,
) -> int:
    return 2 * arg1 + arg2

Desired style How do you think Black should format the above snippets:

def function_name(
        arg1: int,
        arg2: int,
) -> int:
    return 2 * arg1 + arg2

Metadata

Metadata

Assignees

No one assigned

    Labels

    R: duplicateThis issue or pull request already existsT: styleWhat do we want Blackened code to look like?

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions