[Python] Black code formatter line length ignore comment included

Discussão em 'Python' iniciado por Stack, Maio 21, 2025.

  1. Stack

    Stack Membro Participativo

    So, it seems, that Black code formatter default line-length option also takes under consideration comments included in the line

    For example

    if some_very_long_variable_name_out_there_for_example is True: # just a random comment
    pass


    Will produce in

    if (
    some_very_long_variable_name_out_there_for_example is True
    ): # just a random comment
    pass


    , which is definitly correct in terms of black standard

    However, the line if some_very_long_variable_name_out_there_for_example is True: is actually less than 88 symbols and I don't want my code to be kinda visually broken just because I added comment

    Is there an option to disable such behaviour?

    Continue reading...

Compartilhe esta Página