This has being thought, asked, and even agreed as nice thing before,
however, it is blocked due
to ambiguity on the syntax for some corner cases - and, I may be wrong n
that, it would not be possible
to do with the current parser (and Python is not shifting to a more complex
parser for this feature alone).
So, anyway, the official recommendation for long `with` statements is to
use the `\` line continuation character:
```
with \
open(fname1) as f1,\
open(fname2) as f2,\
open(fname3) as f3,\
open(fname4) as f4\
:
```
On Wed, 13 Nov 2019 at 15:30, <[email protected]> wrote:
> Hello everybody,
>
> today I tried to open four files simultaneously by writing
>
> with (
> open(fname1) as f1,
> open(fname2) as f2,
> open(fname3) as f3,
> open(fname4) as f4
> ):
> ...
>
> However, this results in a SyntaxError which is caused by the extra
> brackets. Is there a reason that brackets are not allowed in this place?
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/7GRCN5RNRWPDJ7TWJF7MK4ARSS27DK6Y/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/TQKI2MBDL6AKWFUUU6XSVZFASAEZ5FE3/
Code of Conduct: http://python.org/psf/codeofconduct/