[Python-ideas] Allow with (x as y, z as w):

Cory Benfield cory at lukasa.co.uk
Mon Apr 25 07:36:37 EDT 2016


> On 25 Apr 2016, at 09:38, Ram Rachum <ram at rachum.com> wrote:
> 
> Hi,
> 
> I have a problem: I've got code that has a `with` statement with multiple long names, so I have to break the line awkwardly using the \ character:
> 

Ram,

This request has come up a couple of times before. See the following prior discussions:

- https://mail.python.org/pipermail/python-ideas/2010-September/008021.html <https://mail.python.org/pipermail/python-ideas/2010-September/008021.html>
- https://mail.python.org/pipermail/python-dev/2014-August/135741.html <https://mail.python.org/pipermail/python-dev/2014-August/135741.html>
The upshot is: the restriction on context managers with parentheses like this is relatively likely to stick around. There have been discussions about the relative ambiguity of the syntax you’re using here compared with the syntax of tuples, and some suggestions that it’ll make life particularly tricky for the parser.

I don’t have anything to add to those discussions, just wanted to suggest you may want to familiarise yourself with the previous times we had this conversation before continuing it.

Cory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160425/d2f0e8e2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160425/d2f0e8e2/attachment.sig>


More information about the Python-ideas mailing list