[Python-ideas] with-except-finally blocks
James Edwards
jheiv at jheiv.com
Thu Apr 16 09:33:06 CEST 2015
On Thu, Apr 16, 2015 at 3:22 AM, Andrew Barnert
<abarnert at yahoo.com.dmarc.invalid> wrote:
> Anyway, I like the idea, but does the grammar work? A with that has an optional except and finally at the same level seems potentially ambiguous. For example:
>
> with spam:
> pass
> with eggs:
> pass
> finally:
> pass
Is this any more (or less) ambiguous than:
if cond1:
pass
if cond2:
pass
else:
pass
And we have no issue with that (at least not syntactically). With
respect to readability however, ...
But as far as the example goes, I agree that it's probably a bit mixed
up as was stated.
More information about the Python-ideas
mailing list