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


Groups > comp.lang.python > #98613

bitwise operator, bits dont go into bitbucket..?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From kent nyberg <kent@z-sverige.nu>
Newsgroups comp.lang.python
Subject bitwise operator, bits dont go into bitbucket..?
Date Tue, 10 Nov 2015 17:27:21 -0500
Lines 10
Message-ID <mailman.219.1447194444.16136.python-list@python.org> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace news.uni-berlin.de 3OwfoHRH5cLN1vEbbZUm3g+8xzUNyU6da/ezPhVdZA4Q==
Return-Path <kent@z-sverige.nu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'bits': 0.07; 'subject:into': 0.09; 'python': 0.10; '(when': 0.16; 'bitbucket.': 0.16; 'bitwise': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'then?': 0.16; 'shifting': 0.22; 'bit': 0.23; 'seems': 0.23; 'header:User-Agent:1': 0.26; 'away.': 0.29; 'operators': 0.29; 'code': 0.30; 'add': 0.34; 'gets': 0.35; 'gives': 0.35; 'but': 0.36; 'possible': 0.36; 'to:addr:python- list': 0.36; 'say': 0.37; 'charset:us-ascii': 0.37; 'seem': 0.37; 'doing': 0.38; 'to:addr:python.org': 0.40; 'called': 0.40; 'some': 0.40; 'more': 0.63; 'dont': 0.64; 'received:178': 0.72; '100%': 0.72
Content-Disposition inline
User-Agent Mutt/1.5.23 (2014-03-12)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98613

Show key headers only | 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