Line continuation and comments

Rob Cliffe rob.cliffe at btinternet.com
Wed Feb 22 14:08:08 EST 2023



On 22/02/2023 15:23, Paul Bryan wrote:
> Adding to this, there should be no reason now in recent versions of
> Python to ever use line continuation. Black goes so far as to state
> "backslashes are bad and should never be used":
>
> https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#using-backslashes-for-with-statements

def someFunc():
     HelpText = """\
Left click:             Open spam
Shift + Left click:     Cook spam
Right click:            Crack egg
Shift + Right click:    Fry egg
"""

The initial backslash aligns the first line with the others (in a fixed 
font of course).
Best wishes
Rob Cliffe


More information about the Python-list mailing list