I have a neutral feeling about the proposal but I’d like to suggest
something
We can extend the try/with to other blocks, as suggested. What could be
done to prevent any ambiguity is :
try with blabla as blabla2 :
...
except:
...
Which is equivalent of :
try:
with blabla as blabl2:
...
except:
....
Any other combination should be explicit, except if there’s a nice syntax
but I didn’t find it.
Extending to other blocks would give :
try for ... in ...:
...
except:
...
But if we use the « else » here, what’s going on ? It’s a one line saver
(which is useless) but having many indented blocks doesn’t produce readable
code in my opinion. Saving one indented block while keeping things clear is
a good thing in my opinion. As long as it stays clear (which is not the
case in the for block).
But adding this feature to the with block without using it for other blocks
is a bit strange, imho.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/