Re: [Python-Dev] Grammar for plus and minus unary ops

2009-03-27 Thread Guido van Rossum
Please take this to python-ideas. On Fri, Mar 27, 2009 at 2:15 PM, Joe Smith wrote: > > Jared Grubb wrote: >> >> I'm not a EBNF expert, but it seems that we could modify the grammar  to >> be more restrictive so the above code would not be silently valid.  E.g., >> "++5" and "1+++5" and "1+-+5" a

Re: [Python-Dev] Grammar for plus and minus unary ops

2009-03-27 Thread Joe Smith
Jared Grubb wrote: I'm not a EBNF expert, but it seems that we could modify the grammar to be more restrictive so the above code would not be silently valid. E.g., "++5" and "1+++5" and "1+-+5" are syntax errors, but still keep "1++5", "1+-5", "1-+5" as valid. (Although, '~' throws in a kin

[Python-Dev] Grammar for plus and minus unary ops

2009-03-27 Thread Jared Grubb
I was recently reviewing some Python code for a friend who is a C++ programmer, and he had code something like this: def foo(): try = 0 while tryI was a bit surprised that this was syntactically valid, and because the timeout condition only occurred in exceptional cases, the error has n