In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> Can Python not express the idea of a three-byte int?
>
> For instance, in the working example below, can we somehow collapse the
> three calls of struct.pack into one?
>
> >>> import struct
> >>>
> >>> skip = 0x123456 ; count = 0x80
> >>>
> >>> cdb = ''
> >>> cdb += struct.pack('>B', 0x08)
> >>> cdb += struct.pack('>I', skip)[-3:]
> >>> cdb += struct.pack('>BB', count, 0)
Why not something like this:
skip += struct.pack(">L", skip)[1:]
Dave
--
http://mail.python.org/mailman/listinfo/python-list