A few years ago (yes, it's been that long), I proposed adding a new format code to struct that would pack integers as strings, similar to the 's' format code. In particular, struct.pack('>60G', v) would be a 60-byte big-endian unsigned integer as a string. The feature request is http://bugs.python.org/issue1023290 . Shortly thereafter, it was decided that it wouldn't become a struct format code, but instead would find itself as part of binhex. Raymond Hettinger was supposed to write the function a couple years ago for, I believe, Python 2.4 . It never happened. It still hasn't happened for Python 2.5 or 2.6 . I believe there is still a need for packing integers as strings and unpacking strings as integers, more specifically, offering to Python an interface to _PyLong_FromByteArray() and _PyLong_AsByteArray(). I would be happy to write the functionality and unittests this coming week for 2.6 and 3.0 if I get the ok. If not, I can write it for 2.7 and 3.1 . - Josiah
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