syntax - Python line break in long "with x1 as y1, x2 as y2, x3 as y3" statement -
this question has answer here:
- python multi-line statement 3 answers
i break long statement like:
with x1() y1, x2() y2, x3() y3: # long line #
i have tried:
with ( x1() y1, x2() y2, x3() y3): #
but syntax error. seems following works, find relatively difficult read:
with x1( ) y1, x2( ) y2, x3( ) y3: #
are there suggestions on how best format long with
statement this? thanks.
with x1() y1, \ x2() y2, \ x3() y3:
try that. think it's important keep individual statements 1 line. backslash helps keep explicit > implicit style of python.
reference here: https://www.python.org/dev/peps/pep-0008/
Comments
Post a Comment