Allen Li <cyberdupo56 at gmail.com> writes: > Currently, this works with explicit line continuation, but as all > style guides favor implicit line continuation over explicit, it would > be nice if you could do the following: > > with (open('foo') as foo, > open('bar') as bar, > open('baz') as baz, > open('spam') as spam, > open('eggs') as eggs): > pass > > Currently, this is a syntax error Even if it weren't a syntax error, the syntax would be ambiguous. How will you discern the meaning of:: with ( foo, bar, baz): pass Is that three separate context managers? Or is it one tuple with three items? I am definitely sympathetic to the desire for a good solution to multi-line ‘with’ statements, but I also don't want to see a special case to make it even more difficult to understand when a tuple literal is being specified in code. I admit I don't have a good answer to satisfy both those simultaneously. -- \ “We have met the enemy and he is us.” —Walt Kelly, _Pogo_ | `\ 1971-04-22 | _o__) | Ben Finney
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4