[EMAIL PROTECTED] wrote: > Speaking as the OP, perhaps I should mention: > > > > [-3:] to [1:] is a minor cosmetic improvement > > To my eye, that's Not an improvement. > > '\x08' '\x01\x23\x45' '\x80' '\0' is the correct pack of (0x08, > 0x12345, 0x80, 0) because '\x01\x23\x45' are the significant low three > bytes of a big-endian x12345, thus [-3:]. > > The [1:] fact that we can keep the 3 significant bytes by tossing > exactly 1 byte away after rounding the bit length of that digital > number up to the nearest power of two which happens to be 4 = 3 + 1 is > merely incidental - not of central significance.
I said *cosmetic* improvement and also said "obscures the underlying" need-to-know that 4 - 3 == 1 (which I didn't contemplate needing 2 paragraphs of laborious explanation). -- http://mail.python.org/mailman/listinfo/python-list