A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-April/152819.html below:

[Python-Dev] PEP 572: Assignment Expressions

[Python-Dev] PEP 572: Assignment Expressions [Python-Dev] PEP 572: Assignment ExpressionsMike Miller python-dev at mgmiller.net
Fri Apr 20 17:54:35 EDT 2018
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4