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 

> 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.

Python-Dev mailing list

Reply via email to