[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: invert or not ?

Steve Holden

3/1/2008 1:41:00 PM

Stef Mientki wrote:
> hello,
>
> from the manual I read that a bitwise inversion should be done by invert.
> But from some experiments I see that not works equally well.
> Is this coincidence ?
>
> (The disadvantage of invert is that I've to import operators)
>
Bitwise inversion is performed by the "~" operator. I think your
experimentation has been inadequate:

>>> for i in range(-10000, 10000):
.... if (not i) == (~i):
.... print i
....
-1
>>>

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.hold...