~ bit-wise unary operator
grante at visi.com
Thu Sep 27 01:15:17 CEST 2007
On 2007-09-26, Ladislav Andel <ladaan at iptel.org> wrote:
> why ~ bit-wise unary operator returns -(x+1) and not bit inversion of
> the given integer?
> a = 7978
> a = ~a
> python returns -7979
> but I need to get back 57557 as in C language.
It's not what C language returns, but if you want 57557, you
can get it like this:
>>> (~7978) & 0xffff
Grant Edwards grante Yow! Do you think the
at "Monkees" should get gas on
visi.com odd or even days?
More information about the Python-list