This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Syntax error with not
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.1
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: LambertDW, benjamin.peterson, eric.smith, r.david.murray
Priority: normal Keywords:

Created on 2009-10-29 15:56 by LambertDW, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg94675 - (view) Author: David W. Lambert (LambertDW) Date: 2009-10-29 15:56
lambertdw$ p3
Python 3.1.1 (r311:74480, Oct  2 2009, 12:29:57) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> not 23
False
>>> not(23&1)
False
>>> 1+not(23&1)
  File "<stdin>", line 1
    1+not(23&1)
        ^
SyntaxError: invalid syntax
>>>
msg94677 - (view) Author: David W. Lambert (LambertDW) Date: 2009-10-29 16:54
problem also exists in 2.6.
It's a, in my humble opinion, release blocker.
msg94679 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-10-29 17:11
>>> 1+not
  File "<stdin>", line 1
    1+not
        ^
SyntaxError: invalid syntax
>>> 1+(not(23&1))
1

It's been this way since 2.4 at least, probably earlier.
msg94680 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-10-29 17:13
I'm not sure what release it would be blocking. The oldest version I
have on hand is 2.4, and it's a problem there. If it hasn't caused an
actual problem in that long, then I don't see it as all that critical.
msg94691 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-10-30 00:56
I believe this is actually correct. not does not bind its operand as
powerfully as + does. Thus the parser sees (1 + not) x, which is quite
correctly a syntax error.
History
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51486
2009-10-30 00:56:13benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg94691
2009-10-29 17:13:14eric.smithsetnosy: + eric.smith
messages: + msg94680
2009-10-29 17:11:08r.david.murraysetstatus: open -> closed
priority: normal


nosy: + r.david.murray
messages: + msg94679
resolution: not a bug
stage: resolved
2009-10-29 16:54:41LambertDWsettype: compile error -> behavior
messages: + msg94677
2009-10-29 15:56:26LambertDWcreate