Getting at the bits of a 32-bit integer

Jacob H jacobsmail at
Tue Aug 24 20:03:16 CEST 2004

Peter Hansen <peter at> wrote in message news:<L8SdnepkCsRDV7fcRVn-vA at>...
> Grant Edwards wrote:
> >>If you're new to Python and you are twiddling bits, the odds
> >>favor the new user falsely importing old paradigms from other
> >>languages,
> > 
> > Probably so.
> Especially as the OP didn't say he was trying to break apart
> Ethernet headers, serial data streams, or suchlike.  He just
> seems to want to grab a few bits for his own purposes, and
> like Jeremy I doubt that the need is real (though also like
> he I admit the possibility it could be!) and am quite curious
> to hear from the OP again...
> -Peter

The truth is that I have zero need to fiddle with individual bits. I
just wanted to know how it was done.

And now I do know!


More information about the Python-list mailing list