Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-10 Thread Paul Moore
On 9 November 2011 23:11, Guido van Rossum wrote: > On Wed, Nov 9, 2011 at 2:13 PM, Greg Ewing > wrote: >> In my current grammar, it's a syntax error on its own, >> but 'f(yield from x, y)' parses as 'f((yield from x), y)', >> which seems like a reasonable interpretation to me. > > Once you real

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Greg Ewing
On 10/11/11 14:50, Nick Coghlan wrote: I'd actually be amenable to making it legal to omit the extra parentheses for both yield& yield from in the single argument case where there's no ambiguity... > The way your patch tried to do it also allowed "f(yield from x, 1)" which strikes me as being

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Nick Coghlan
On Thu, Nov 10, 2011 at 10:35 AM, Greg Ewing wrote: > On 10/11/11 11:43, Tim Delaney wrote: >> >> We have precedent for being more restrictive initially, and relaxing those >> restrictions later. >> >> I suggest that the more restrictive implementation go in now so that >> people >> can start play

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Greg Ewing
On 10/11/11 11:43, Tim Delaney wrote: We have precedent for being more restrictive initially, and relaxing those restrictions later. I suggest that the more restrictive implementation go in now so that people can start playing with it. If the discussion comes to a consensus on more relaxed synta

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Greg Ewing
On 10/11/11 12:11, Guido van Rossum wrote: Actually it is valid, meaning "yield (expr, expr)" in any context where "yield expr" is valid Hmmm, it seems you're right. I was testing it using my patched yield-from version of Python, where it has apparently become a syntax error. I didn't mean to

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Guido van Rossum
On Wed, Nov 9, 2011 at 2:13 PM, Greg Ewing wrote: > Guido van Rossum wrote: >> >> I see this as inevitable. By the time the parser sees 'yield' it has >> made its choices; the 'from' keyword cannot modify that. So whenever >> "yield expr" must be parenthesized, "yield from expr" must too. > > This

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Tim Delaney
On 10 November 2011 09:13, Greg Ewing wrote: > This is patently untrue, because by version of the grammar > allows 'f(yield from x)', while disallowing 'f(yield x)'. > > I made a conscious decision to do that, and I'm a bit alarmed > at this decision being overridden at the last moment with no >

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Greg Ewing
Guido van Rossum wrote: I see this as inevitable. By the time the parser sees 'yield' it has made its choices; the 'from' keyword cannot modify that. So whenever "yield expr" must be parenthesized, "yield from expr" must too. This is patently untrue, because by version of the grammar allows 'f(

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Guido van Rossum
I see this as inevitable. By the time the parser sees 'yield' it has made its choices; the 'from' keyword cannot modify that. So whenever "yield expr" must be parenthesized, "yield from expr" must too. (And yes, there are parsing systems that don't have this restriction. But Python's does and we li

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Nick Coghlan
On Wed, Nov 9, 2011 at 8:59 PM, Greg Ewing wrote: > Nick Coghlan wrote: >> I'll add a new test to ensure "yield from x" requires parentheses whenever >> "yield x" requires them (and fix the Grammar file on the implementation >> branch >> accordingly). > > Wait a minute, there's nothing in the PEP

Re: [Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

2011-11-09 Thread Greg Ewing
Nick Coghlan wrote: In reviewing Zbyszek's doc updates and comparing them against the Grammar, I discovered a gratuitous change in the implementation: it allows a bare (i.e. no parentheses) 'yield from' as an argument to a function. I'll add a new test to ensure "yield from x" requires parenthe