On Thursday, July 21, 2016 at 10:05:02 AM UTC+2, Sergi Almacellas Abellana 
wrote:
>
> El 20/07/16 a les 17:11, Marko Randjelovic ha escrit: 
> > Let us look at pyson expresson: 
> > 
> > If(~Eval('end_date', None) 
> > 
> > What is ~? Experimenting with Python interpreter, ~True is -2 and ~False 
> > is -1. I thought ~ is for negation, but -1 and -2 are not boolean values 
> > even in C they are 0 or >0. 
>
> In python ~ is the shourcut of Bitwise Inversion [1]. 
> In PySON is the shourtcut of the Not operator: So your statement means: 
>
>  > If(Not(Eval('end_date', None)) 
>
> Which I think you will understand :) 
>

Of course, but in examples I have neither ~ nor Not is imported from 
trytond.pyson. How Python knows about new character of '~'? Also, how is 
achieved possible to use ~ as an operator (there are no parenthesis)? 
 

>
> [1] 
>
> https://docs.python.org/2/library/operator.html#mapping-operators-to-functions
>  
> -- 
> Sergi Almacellas Abellana 
> www.koolpi.com 
> Twitter: @pokoli_srk 
>

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/97880cab-998b-446a-8112-159452ba72d5%40googlegroups.com.

Reply via email to