El 23/07/16 a les 19:02, Marko Randjelovic ha escrit:
On Friday, July 22, 2016 at 9:25:09 AM UTC+2, Cédric Krier wrote:
On 2016-07-21 12:40, Marko Randjelovic wrote:
> 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)?
'~' is a standard python operator so it does not need to be imported.
See
https://docs.python.org/2/library/operator.html#operator.__invert__
<https://docs.python.org/2/library/operator.html#operator.__invert__>
~ is a standard operator but it's purpose is bitwise inversion. How did
we make it become logical negation?
Because we define the __invert__ operator of every PYSON object:
http://hg.tryton.org/trytond/file/9a65b63b90f4/trytond/pyson.py#l40
--
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/9b690de2-ef0a-2711-1167-c2f41a5e4a31%40koolpi.com.