syntax - Python line break in long "with x1 as y1, x2 as y2, x3 as y3" statement -


this question has answer here:

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

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -