Bob Ippolito <bob at redivi.com> writes: > On Jan 6, 2005, at 8:17, Michael Hudson wrote: > >> Ilya Sandler <ilya at bluefir.net> 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4