On 2018-04-20 12:43, Chris Angelico wrote:
> Except that that's now a feature of expressions, NOT of the loop
> construct. And then you're left with: why not permit this everywhere?
Sorry, I didn't understand. Didn't mean to imply it couldn't be used
everywhere.
> What would these mean?
My expectations:
with open(fn) as f: # current behavior
with (open(fn) as f): # syntax error, missing clause
with closing(urlopen(url)) as dl: # current behavior
with closing(urlopen(url) as dl): # syntax error, missing clause
with (closing(urlopen(url)) as dl): # syntax error, missing clause
In other words, the with statement would continue to require an as clause
outside of the parentheses. A double name binding doesn't seem very useful however.
-Mike
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com