[Python-Dev] adding Construct to the standard library? (original) (raw)

Gustavo Carneiro gjcarneiro at gmail.com
Tue Apr 18 15:25:45 CEST 2006


why include Construct? * the struct module is very nice, but very limited and non-pythonic as well * pure python (no platform/security issues)

IMHO this is a drawback. More on this below.

* easy to use and extend (follows the componentization pattern) * declarative: you don't need to write executable code for most cases

Well, declarative is less flexible. OTOH declarative is nice in the way it is more readable and allows more optimisations.

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?

This is a very nice library indeed. But the number one feature that I need in something like this would be to use C. That's because of my application specific requirements, where i have observed that reapeatedly using struct.pack/unpack and reading bytes from a stream represents a considerable CPU overhead, whereas the same thing in C would be ultra fast.

IMHO, at least in theory Construct could have small but fast C extension to take care of the encoding and decoding, which is the critical path. Everything else, like the declaration part, can be python, as it is usually done once on application startup.

If you agree to go down this path I might even be able to volunteer some of my time to help, but it's not my decision.

Best regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20060418/626d06f1/attachment.html



More information about the Python-Dev mailing list