On 5 Aug, 20:41, "Martin P. Hellwig" <martin.hell...@dcuktec.org> wrote: > Paul Rubin wrote: > > "Martin P. Hellwig" <martin.hell...@dcuktec.org> writes: > >> Is there an advantage using shifts and masks over my kitchen type solution? > > > Weren't you complaining about the 8-to-1 expansion from turning each bit > > to an ascii char? > > Yes you are (of course) right, my 'dream' solution would be something > that accepts slice indeces on bit level. Your reasoning did reveal some > flaws in my approach though ;-) > > -- > MPHhttp://blog.dcuktec.com > 'If consumed, best digested with added seasoning to own preference.'
Ahh huh -- found it... ID: DLT119 Desc: datasyzygy misc. development, production and accounts. Date: 2008-12-09 File: pybits.py """ Implements a python level interface to reading bit fields with an associated type. Fields are accessed via __getitem__ and must be a valid python name. eg: class MyStructure: a = BitField(4, int) b = BitField(6, int) c = BitField(2, int) d = BitField(36, str) """ Ummm, seems I left the rest pretty vague, but I'm guessing that's what you're after, and I'm fairly curious to see what I wrote... mind you, not too hard to write again now that's jogged my memory! (although after a couple at the pub, not going to do it tonight!) Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list