Re: [Python-Dev] Allow tuple unpacking in return and yield statements

2017-11-30 Thread Guido van Rossum
I'd be wary of going too far here. The parser (which uses a different representation for the grammar) may not support all of these -- in particular I would guess that the syntax for subscriptions is actually more complicated than shown, because of slices. Do you allow a[x:y, *rest]? On Thu, Nov 30

Re: [Python-Dev] Allow tuple unpacking in return and yield statements

2017-11-30 Thread Brett Cannon
On Thu, 30 Nov 2017 at 05:01 David Cuthbert wrote: > Henk-Jaap noted that the grammar section of the language ref for yield and > return should also be updated from expression_list to starred_list with > this change. As noted elsewhere, this isn't in-sync with the Grammar file > (intentionally, i

Re: [Python-Dev] Allow tuple unpacking in return and yield statements

2017-11-30 Thread David Cuthbert
Henk-Jaap noted that the grammar section of the language ref for yield and return should also be updated from expression_list to starred_list with this change. As noted elsewhere, this isn't in-sync with the Grammar file (intentionally, if I understand correctly). I took a look, and I believe t

Re: [Python-Dev] Allow tuple unpacking in return and yield statements

2017-11-25 Thread Nick Coghlan
On 26 November 2017 at 09:22, Terry Reedy wrote: > Since return and yield are often the first half of a cross-namespace > assignment, requiring the () is a bit surprising. Perhaps someone else has > a good reason for the difference. These kinds of discrepancies tend to arise because there are a

Re: [Python-Dev] Allow tuple unpacking in return and yield statements

2017-11-25 Thread Guido van Rossum
I think the proposal is reasonable and won't require a PEP. On Nov 25, 2017 3:25 PM, "Terry Reedy" wrote: > On 11/25/2017 1:55 AM, David Cuthbert wrote: > >> First time contributing back -- if I should be filing a PEP or something >> like that for this, please let me know. >> > > I don't think a

Re: [Python-Dev] Allow tuple unpacking in return and yield statements

2017-11-25 Thread Terry Reedy
On 11/25/2017 1:55 AM, David Cuthbert wrote: First time contributing back -- if I should be filing a PEP or something like that for this, please let me know. I don't think a PEP is needed. Coming from https://bugs.python.org/issue32117, unparenthesized tuple unpacking is allowed in assignme

[Python-Dev] Allow tuple unpacking in return and yield statements

2017-11-25 Thread David Cuthbert
First time contributing back -- if I should be filing a PEP or something like that for this, please let me know. Coming from https://bugs.python.org/issue32117, unparenthesized tuple unpacking is allowed in assignments: rest = (4, 5, 6) a = 1, 2, 3, *rest but not in yield or return sta