0 + not 0

Irmen de Jong irmen.NOSPAM at xs4all.nl
Sat Jul 11 06:38:57 EDT 2015


On 11-7-2015 12:26, candide wrote:
>>>> 0 + not 0
>   File "<stdin>", 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 occur in an arithmetic expression.
Maybe you meant to use the bitwise not:

>>> 0 + ~0
-1


Irmen



More information about the Python-list mailing list