Bit arrays.

rdudfield at my-deja.com rdudfield at my-deja.com
Fri Feb 11 01:54:18 EST 2000


In article <06c201bf7441$9b05ad40$01ffffc0 at worldnet.att.net>,
  "Emile van Sebille" <emile at fenx.com> wrote:
> I often set 'bit' style flags in integers, but leave them as
> integers.  e.g., add 2^5+2^3+2^2 to an int to turn on bits
> 5,3,2 (or 4,2,1)
>
> What will you be doing?
>
> --
>
> Emile van Sebille
> emile at fenx.com
> -------------------
>

Thanks for that, I forgot how to do it and couldn't work it out.

I found another way which I'm scared to mention... it involved splitting
the 8 bits up into two halves getting their hex values and lots more
weirdness.  This way is much nicer, and faster too if you put the
results of pow in a dictionary.




Thanks again :)

Rene.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list