bit shifting question

David Stockwell winexpert at hotmail.com
Mon May 17 14:45:28 EDT 2004


Hi,
My background is c/c++ and java.  I'm learning python at this point.

My question is does python share java's peculiar mode of bit shifting, or 
does python adhere closer to c's bit shifting?

in java there are 3 kinds of bit shifts:
  <<      (shift left)
  >>     (preserve the sign bit as we move right )
  >>>   (0 filled on the left as we move right)

In C, the behavior is
  <<  (shift left)
   >> (shift right , 0 filled  (like java's >>>'))

I tried looking around but haven't really got an answer yet.  I guess I need 
to write a mini python script.  Please don't write any code, I'm just 
looking for a website or something where I can figure this stuff out in 
python.

Thanks in advance,

David
-------
Cell: http://cellphone.duneram.com/index.html
Cam: http://www.duneram.com/cam/index.html
Tax: http://www.duneram.com/index.html

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/





More information about the Python-list mailing list