Arup R. wrote in post #1139420:
Matthew K. wrote in post #1139417:
Thank you very much. Could you tell me what do you mean by below ?
Probably one small use-case from your experience.
for you. They’re not exactly string manipulation functions after all,
they’re data de/serialisers.
Well, for example, imagine you’re saving some image data as a TGA file.
You could do something like this:
COLOUR_MAP_NONE = 0
IMAGE_TYPE_RGB = 2
tga_header = [
0, 0, 32, # palette
0, 0, # x, y origin of pixels
255, 255, # width, height of image
24, # bits per pixel
… and similarly, if you’re loading it:
identsz, cm_type, image_type,
cm_start, cm_length, cm_bits,
xstart, ystart, width, height, bits, descriptor =
From my personal experience, I’ve mostly used pack/unpack for sending
data packets over a network (e.g. HTTP/2 is a binary format).