Bob Ippolito <[EMAIL PROTECTED]> writes: > On Jan 6, 2005, at 8:17, Michael Hudson wrote: > >> Ilya Sandler <[EMAIL PROTECTED]> writes: >> >>> A problem: >>> >>> The current struct.unpack api works well for unpacking C-structures >>> where >>> everything is usually unpacked at once, but it >>> becomes inconvenient when unpacking binary files where things >>> often have to be unpacked field by field. Then one has to keep track >>> of offsets, slice the strings,call struct.calcsize(), etc... >> >> IMO (and E), struct.unpack is the primitive atop which something more >> sensible is built. I've certainly tried to build that more sensible >> thing at least once, but haven't ever got the point of believing what >> I had would be applicable to the general case... maybe it's time to >> write such a thing for the standard library. > > This is my ctypes-like attempt at a high-level interface for struct. > It works well for me in macholib: > http://svn.red-bean.com/bob/py2app/trunk/src/macholib/ptypes.py
Unsurprisingly, that's fairly similar to mine :) Cheers, mwh -- If trees could scream, would we be so cavalier about cutting them down? We might, if they screamed all the time, for no good reason. -- Jack Handey _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com