"Skipper Seabold" <[email protected]> wrote
You can just do a binary AND with your consts and your bitfield value to
get
> each bit. The values will be the actual value (2, 4, 8, etc.) but if
> you
> use these as a boolean it won't matter.
No that's perfect. It looks like I need to read up a bit more (pun
not intended) on the binary AND, but I think I see what it does and I
understand your example.
You can go to the Using the OS topic in my tutorial for a quick tutoerial
on how to extracts bits from a bitfield. There is a "sidebar" box entitled
"Bitwise Operations and Flags" which explains the idea
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor