[Python-Dev] PEP 572: Assignment Expressions (original) (raw)
Guido van Rossum guido at python.org
Mon Apr 23 00:58:16 EDT 2018
- Previous message (by thread): [Python-Dev] PEP 572: Assignment Expressions
- Next message (by thread): [Python-Dev] PEP 572: Assignment Expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Please stop debating <expr> as <name>
. Nobody is being swayed by anything
in this subthread. Let's move on.
On Sun, Apr 22, 2018 at 3:27 PM, Chris Angelico <rosuav at gmail.com> wrote:
On Mon, Apr 23, 2018 at 8:20 AM, Mike Miller <python-dev at mgmiller.net> wrote: > > On 2018-04-22 14:33, Chris Angelico wrote: >> >> with open(fn) as f: >> with (open(fn) as f): >> >> These two do the same thing, but only because a file object's >> enter returns self. So it's dangerous, because it WILL work... and >> people will get into the habit of parenthesizing to permit a 'with' >> statement to go across line breaks. And then they'll use a different >> context manager, like closing(), or a PsycoPG2 database connection (I >> think), where it returns something else. And it'll work, until they go >> over multiple lines, and then suddenly the semantics change. > > > > Why do you think folks will be rushing to parenthesize with statements when > it has always been a syntax error, there is years of code and docs that show > otherwise, no use cases, and will take years for 3.8 to trickle out?
Because it's been requested a number of times as a way to allow a 'with' statement to go across lines without backslashes. If it becomes possible, it will be used. ChrisA
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ guido%40python.org
-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180422/f7dcfff7/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 572: Assignment Expressions
- Next message (by thread): [Python-Dev] PEP 572: Assignment Expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]