[Python] In Python, how to tweak Black formatter, if possible?

Discussão em 'Python' iniciado por Stack, Junho 29, 2025.

  1. Stack

    Stack Membro Participativo

    I know that Black is an opinionated formatter, but I love everything it does except one major thing. When I have a function with multiple arguments, instead of displaying it like this:

    def example_function(arg_1: str, arg_2: bool, arg_3: int = 0, arg_4: int = 1, arg_5: float = 0.0):
    pass


    I'd rather display it as follows for readability:

    def example_function(
    arg_1: str,
    arg_2: bool,
    arg_3: int = 0,
    arg_4: int = 1,
    arg_5: float = 0.0
    ):


    Is this achievable with Black or some other formatter? I have this problem several times and it makes me consider not to use Black, either something else or nothing at all.

    Any ideas or comments?

    Continue reading...

Compartilhe esta Página