What's your choice when handle complicated C structures.

Glenn Linderman v+python at g.nevcal.com
Wed Nov 5 18:37:58 CET 2008

On approximately 11/4/2008 5:31 PM, came the following characters from 
the keyboard of Marc 'BlackJack' Rintsch:
> On Tue, 04 Nov 2008 16:52:17 -0800, 一首诗 wrote:
>> Now I'm using the upack function of 'struct' module, but it's really
>> annoying to write fmt strings for complicated structures.
>> What will be your choice when handling binary structures?
> http://construct.wikispaces.com/

Interesting.  It seems to be a bit more capable around the edges than 
unpack, and certainly has a friendlier looking syntax, but I wonder how 
the performance compares to unpack, for the cases they both handle?  
Seems like for cases they both handle, it could be beneficial to compile 
to the equivalent unpack for speed?

Containers look nice, but it seems it would be nice to allow multiple 
targets: Containers, dicts (with a special entry giving the order of the 
fields, perhaps, for reconstruction; maybe that is what a container is, 
already?), namedtuples, all seem to be reasonable alternative targets, 
with different usage tradeoffs, of course.

Glenn -- http://nevcal.com/
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking

More information about the Python-list mailing list