[Python-Dev] Multiline with statement line continuation
ethan at stoneleaf.us
Sat Aug 16 05:29:09 CEST 2014
On 08/15/2014 08:08 PM, Steven D'Aprano wrote:
> On Fri, Aug 15, 2014 at 02:08:42PM -0700, Ethan Furman wrote:
>> On 08/13/2014 10:32 AM, Steven D'Aprano wrote:
>>> (2) Also note that *this is already the case*, since tuples are made by
>>> the commas, not the parentheses. E.g. this succeeds:
>>> # Not a tuple, actually two context managers.
>>> with open("/tmp/foo"), open("/tmp/bar", "w"):
>> Thanks for proving my point! A comma, and yet we did *not* get a tuple
>> from it.
> Um, sorry, I don't quite get you. Are you agreeing or disagreeing with
> me? I spent half of yesterday reading the static typing thread over on
> Python-ideas and it's possible my brain has melted down *wink* but I'm
> confused by your response.
My point is that commas don't always make a tuple, and your example above is a case in point: we have a comma
separating two context managers, but we do not have a tuple, and your comment even says so.
> is a poor argument (that is, I'm disagreeing with it), since *single*
> line parens-free with statements are already syntactically a tuple:
> with spam, eggs, cheese: # Commas make a tuple, not parens.
This point I do not understand -- commas /can/ create a tuple, but don't /necessarily/ create a tuple. So,
semantically: no tuple. Syntactically: I don't think there's a tuple there this way either. I suppose one of us should
look it up in the lexar. ;)
More information about the Python-Dev