[issue1023290] proposed struct module format code addition

Antoine Pitrou report at bugs.python.org
Sat Jul 5 20:34:56 CEST 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Pickle is a solution only if you accept the target format to be opaque,
which is not what you are looking for usually.
Once again I just had to write the cumbersome:

junk_len = 1024
junk =  (("%%0%dX" % junk_len) % random.getrandbits(junk_len *
8)).decode("hex")

... because there is no obvious way to convert longs to bytes.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1023290>
_______________________________________


More information about the Python-bugs-list mailing list