Skip to content

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

Closed

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

Activity

  1. added
    T: styleWhat do we want Blackened code to look like?
    on Apr 18, 2021
  2. JelleZijlstra commented on Apr 18, 2021

    @JelleZijlstra
    Collaborator

    We're unlikely to change such a basic aspect of Black's formatting at this time.

  3. ichard26 commented on Apr 18, 2021

    @ichard26
    Collaborator

    See also GH-48, GH-1178, and GH-1127.

  4. nbievre commented on Apr 18, 2021

    @nbievre
    Author

    Noted! Thanks for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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