">

(original) (raw)

hello folks

after several people (several > 10) contacted me and said "IMHO 'construct' is a good candidate for stdlib",
i thought i should give it a try. of course i'm
not saying it should be included right now, but in 6 months time, or such a

timeframe (aiming at python 2.6? some 2.5.x release?)

a little intro:
"Construct" (

http://pyconstruct.sourceforge.net/) is a library for declaratively defining data structures at the bit-level.

these constructs can be used to parse raw data into objects, or build objects into raw data. you can see a couple
of examples at

http://pyconstruct.wikispaces.com/examples

being "data structures" they are not limited to simple structures -- they can be linked lists, for example, or an enitre
efl32 file, with sections and pointers (included in the distribution). currently i'm writing a parser of ext2 file systems,

to allow inspecting file systems without mounting.

why include Construct?
* the struct module is very nice, but very limited and non-pythonic as well
* pure python (no platform/security issues)
* lots of people need to parse and build binary data structures, it's not an esoteric library

* license: public domain
* quite a large user base for such a short time (proves the need of the community)
* easy to use and extend (follows the componentization pattern)
* declarative: you don't need to write executable code for most cases


why not:
* the code is (very) young. stable and all, but less than a month on the loose.
* new features may still be added / existing ones may be changed in a non-backwards-compatible manner

so why am i saying this now, instead of waiting a few months for it to maturet?

well, i wanted to get feedback.
those of you who have seen/used the library, please tell me what you think:
* is it suitable for a standard library?
* what more features would you want?
* any changes you think are necessary?

i'm starting this now, in order to have a mature version in the (near) future.

thanks,

-tomer