[Tutor] operators >> and &

Wayne Werner waynejwerner at gmail.com
Sat Feb 13 20:45:52 CET 2010


On Sat, Feb 13, 2010 at 12:58 PM, David Abbott <david at pythontoo.com> wrote:

> <snip>
> I don't understand the l>>24 & 255.
>
> from the docs;
> Right Shift a >> b rshift(a, b)
> Bitwise And a & b and_(a, b)
>

They're binary operations...

If you're not familiar, wikipedia or google can find you many sources.

In a nutshell:

0110 >> 1 == 0011
0011 >> 1 == 0001

0110 & 0101 == 0100
0100 & 0001 == 0000

HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100213/8385755d/attachment.htm>


More information about the Tutor mailing list