Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98613

bitwise operator, bits dont go into bitbucket..?

From kent nyberg <kent@z-sverige.nu>
Newsgroups comp.lang.python
Subject bitwise operator, bits dont go into bitbucket..?
Date 2015-11-10 17:27 -0500
Message-ID <mailman.219.1447194444.16136.python-list@python.org> (permalink)

Show all headers | View raw


Im reading about bitwise operators and is it true to say they dont work 100% as in C?
bitwise operators in C seem to result in bits going to the so called bitbucket. 
For example, 0b00000001. Shifting it >> 1  in C it seems to add on zero to the left and the 1 to the right gets throwned away.

But doing it in python just adds one more bit, from the left.  
That is, 0b00000001 >> 1     = 0b000000001.

Bitwise operators in C (when reading examples,) gives some time code that check specific bits by
shifting the bits left and right to make every bit but the specific one to zeros. 
As I understand bitwise operators in python, this is not possible then?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

bitwise operator, bits dont go into bitbucket..? kent nyberg <kent@z-sverige.nu> - 2015-11-10 17:27 -0500

csiph-web