How to break a long with statement in python -
i have line of code in python this:
with long_name_function(p) a, other_long_name_function():
and want break in multiple lines, because long, use backslashes, considered bad practice. use contextlib.nested, deprecated, there other alternative?
this disregards premise of question recommend using backslashes in case:
with really_really_long_name_function(p) f1, \ other_really_really_long_name_function() f2: pass
as @jonclements said, can't use brackets or commas in case, there's no alternative backslashes way go , code looks pretty clean imo.
Comments
Post a Comment