[Python-Dev] proposed struct module format code addition

Bob Ippolito bob at redivi.com
Sun Oct 3 10:58:11 CEST 2004


On Oct 3, 2004, at 4:29 AM, Josiah Carlson wrote:

> I have produced a patch against the latest CVS to add support for two
> new formatting characters in the struct module.  It is currently an 
> RFE,
> which I include a link to at the end of this post.  Please read the
> email before you respond to it.
--
> I had proposed two new formatting characters, 'g' and 'G' (for biGint 
> or
> lonG int).
>
> There was one primary purpose, to offer users the opportunity to 
> specify
> their own integer lengths (very useful for cryptography, and real-world
> applications that involve non-standard sized integers).  Current
> solutions involve shifting, masking, and multiple passes over data.

I'm +1 on this.. I've dealt with 24, 48, and 128 bit integers before 
and it's always been a pain with the struct module.  Another addition 
I'd like to see is bit length struct fields, but that opens an entirely 
different can of worms.

-bob


More information about the Python-Dev mailing list