Re: 0 + not 0

2015-07-11 Thread Gregory Ewing
Ian Kelly wrote: I must concur. The grammar as written does not actually produce 1 + not 0. I think it's still worthwhile opening a bug, because the behavior is surprising and possibly not intentional. It's almost certainly intentional. If you want not a + b > c to be interpreted as no

Re: 0 + not 0

2015-07-11 Thread random832
On Sat, Jul 11, 2015, at 07:20, Chris Angelico wrote: > On Sat, Jul 11, 2015 at 9:12 PM, Luuk wrote: > > It can occur in an arithmetic expression, and 'not' has a higher precedence > > than '+' > > (https://docs.python.org/2/reference/expressions.html#operator-precedence) > > > > I think you're m

Re: 0 + not 0

2015-07-11 Thread Mark Lawrence
On 11/07/2015 17:56, Ian Kelly wrote: On Sat, Jul 11, 2015 at 10:02 AM, Stefan Ram wrote: I look at Python 3.4.3: a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr So, »not 0« must be an »m_expr« when used as the right operand of »+«. m_expr ::= u_expr | m_expr "*" u_expr | m

Re: 0 + not 0

2015-07-11 Thread Ian Kelly
On Sat, Jul 11, 2015 at 10:02 AM, Stefan Ram wrote: > I look at Python 3.4.3: > > a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr > > So, »not 0« must be an »m_expr« when used as the right operand of »+«. > > m_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | m_expr "/"

Re: 0 + not 0

2015-07-11 Thread MRAB
On 2015-07-11 17:02, Stefan Ram wrote: Serhiy Storchaka writes: On 11.07.15 13:26, candide wrote: 0 + not 0 File "", line 1 0 + not 0 ^ SyntaxError: invalid syntax What is syntactically wrong with 0 + not 0? This looks as a bug to me. Please file a report

Re: 0 + not 0

2015-07-11 Thread candide
Le samedi 11 juillet 2015 15:38:51 UTC+2, Serhiy Storchaka a écrit : > This looks as a bug to me. Please file a report on http://bugs.python.org. OK, I'll report. -- https://mail.python.org/mailman/listinfo/python-list

Re: 0 + not 0

2015-07-11 Thread Serhiy Storchaka
On 11.07.15 13:26, candide wrote: 0 + not 0 File "", line 1 0 + not 0 ^ SyntaxError: invalid syntax What is syntactically wrong with 0 + not 0? This looks as a bug to me. Please file a report on http://bugs.python.org. -- https://mail.python.org/mailma

Re: 0 + not 0

2015-07-11 Thread candide
Le samedi 11 juillet 2015 14:05:58 UTC+2, Chris Angelico a écrit : > You'll see down below a footnote referring to this as a special case. I didn't spot the footnote and I don't regard it as dealing with a "special case": the footnote is paraphrasing the precedence hierarchy given by the table.

Re: 0 + not 0

2015-07-11 Thread Chris Angelico
On Sat, Jul 11, 2015 at 9:54 PM, candide wrote: > Le samedi 11 juillet 2015 13:31:03 UTC+2, Luuk a écrit : > >> >> But operator precedence of 'not' is higher than of '+' > > > Right but what does this prove? For instance, unary minus has higher > precedence than exponentiation but the expres

Re: 0 + not 0

2015-07-11 Thread candide
Le samedi 11 juillet 2015 13:31:03 UTC+2, Luuk a écrit : > > But operator precedence of 'not' is higher than of '+' Right but what does this prove? For instance, unary minus has higher precedence than exponentiation but the expression 2 ** -1 doesn't raise a syntax error. -- https://ma

Re: 0 + not 0

2015-07-11 Thread candide
Le samedi 11 juillet 2015 13:21:03 UTC+2, Chris Angelico a écrit : > I think you're misreading the table; 'not' has *lower* precedence than '+'. > Right but Python docs helps a lot in misreading ;) Following the iconicity principle, it's pretty obvious that one has to display table priority beg

Re: 0 + not 0

2015-07-11 Thread Luuk
On 11-7-2015 13:20, Chris Angelico wrote: On Sat, Jul 11, 2015 at 9:12 PM, Luuk wrote: It can occur in an arithmetic expression, and 'not' has a higher precedence than '+' (https://docs.python.org/2/reference/expressions.html#operator-precedence) I think you're misreading the table; 'not' ha

Re: 0 + not 0

2015-07-11 Thread Chris Angelico
On Sat, Jul 11, 2015 at 9:12 PM, Luuk wrote: > It can occur in an arithmetic expression, and 'not' has a higher precedence > than '+' > (https://docs.python.org/2/reference/expressions.html#operator-precedence) > I think you're misreading the table; 'not' has *lower* precedence than '+'. > But,

Re: 0 + not 0

2015-07-11 Thread Luuk
On 11-7-2015 12:38, Irmen de Jong wrote: On 11-7-2015 12:26, candide wrote: 0 + not 0 File "", line 1 0 + not 0 ^ SyntaxError: invalid syntax What is syntactically wrong with 0 + not 0? I would say that the boolean operator 'not' cannot oc

Re: 0 + not 0

2015-07-11 Thread Irmen de Jong
On 11-7-2015 12:26, candide wrote: >>>> 0 + not 0 > File "", line 1 > 0 + not 0 > ^ > SyntaxError: invalid syntax >>>> > > > What is syntactically wrong with 0 + not 0? > I would say that the boolean operator 'not

Re: 0 + not 0

2015-07-11 Thread Chris Angelico
On Sat, Jul 11, 2015 at 8:26 PM, candide wrote: >>>> 0 + not 0 > File "", line 1 > 0 + not 0 > ^ > SyntaxError: invalid syntax >>>> > > > What is syntactically wrong with 0 + not 0? I'm actually not sure why thi

0 + not 0

2015-07-11 Thread candide
>>> 0 + not 0 File "", line 1 0 + not 0 ^ SyntaxError: invalid syntax >>> What is syntactically wrong with 0 + not 0? -- https://mail.python.org/mailman/listinfo/python-list