[issue24612] not operator expression raising a syntax error

2021-09-04 Thread Andre Roberge
Change by Andre Roberge : -- nosy: +aroberge ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue24612] not operator expression raising a syntax error

2021-09-04 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- keywords: +patch pull_requests: +26599 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28170 ___ Python tracker __

[issue24612] not operator expression raising a syntax error

2021-09-04 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I think the best outcome here is to refine the syntax error. Making it behave a bit better is going to be quite a pain because of how unary "-" and "not" work on the priority level in the grammar. I also don't think that facilitating the concatenation

[issue24612] not operator expression raising a syntax error

2021-09-04 Thread Irit Katriel
Irit Katriel added the comment: Reproduced on 3.11: >>> 0 + not 0 File "", line 1 0 + not 0 ^^^ SyntaxError: invalid syntax >>> - not 0 File "", line 1 - not 0 ^^^ SyntaxError: invalid syntax -- nosy: +iritkatriel, pablogsal versions: +Python 3.11 -Python 3.5

[issue24612] not operator expression raising a syntax error

2016-01-03 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti versions: +Python 3.5, Python 3.6 -Python 3.4 ___ Python tracker ___ ___ Python-bugs-

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Martin Panter
Martin Panter added the comment: BTW “yield” is not a fair comparison because its syntax is even stranger (due to originally being a “yield” statement): def g(): x = yield + 1 # Yield the value +1 y = (yield) + 1 # Add 1 after yielding return (yield) # Mandatory brackets ---

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Martin Panter
Martin Panter added the comment: Funny, I ran into this one or two days ago, when refactoring some code that used the bitwise exclusive-or operator, since there is no boolean exclusive or: -if (x == a) ^ (y != b): ... +aa = x == a +bb = y == b +if aa ^ not bb: ... It is fairly clear what I wan

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Martin Panter
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Stefan Behnel
Stefan Behnel added the comment: Hmm, right. I see your point and also the analogy with "yield". I could live with (maybe) giving it a better error message suggesting to use parentheses for clarity and otherwise keeping it a SyntaxError. -- ___ Pyth

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Matthew Barnett
Matthew Barnett added the comment: "not" has a lower priority than unary "-"; this: not a < b is parsed as: not (a < b) How would you parse: 0 + not 0 + 0 ? Would it be parsed as: 0 + not (0 + 0) ? Similar remarks could apply to "yield": 0 + yield 0 which is also a

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Stefan Behnel
Stefan Behnel added the comment: It looks like perfectly valid syntax to me and I cannot see why it should be semantically rejected. I disagree that it shouldn't be changed. I think it's a (minor) bug that should eventually get fixed. -- nosy: +scoder _

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Jul 11, 2015 at 03:23:53PM +, candide wrote: > > New submission from candide: > > Expressions such as > > a + not b > a * not b > + not b > - not b > > raise a SyntaxError, for instance : > > > >>> 0 + not 0 > File "", line 1 > 0 + not 0

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: "not not 0" is compiled successful, while "+ not 0", "- not 0", and "~ not 0" are rejected. -- nosy: +benjamin.peterson ___ Python tracker __

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread candide
New submission from candide: Expressions such as a + not b a * not b + not b - not b raise a SyntaxError, for instance : >>> 0 + not 0 File "", line 1 0 + not 0 ^ SyntaxError: invalid syntax >>> - not 0 File "", line 1 - not 0 ^ SyntaxError: invalid syntax >>> i