Re: [Python-Dev] Encoding variable-length integers/counts in pickle

2018-07-10 Thread Antoine Pitrou
On Tue, 10 Jul 2018 02:53:47 +0100 MRAB wrote: > In the regex module I use an encoding scheme when pickling pattern > objects which is based on the way MIDI encodes variable-length integers, > and I think it might have a use in a pickle protocol. > > In the basic format, an integer is split up

Re: [Python-Dev] Encoding variable-length integers/counts in pickle

2018-07-10 Thread Andrew McLean
Google Protocol Buffers use something similar, which they call " Base 128 Varints" https://developers.google.com/protocol-buffers/docs/encoding#varints I prefer the way this handles negative numbers. - Andrew On 10

[Python-Dev] Encoding variable-length integers/counts in pickle

2018-07-09 Thread MRAB
In the regex module I use an encoding scheme when pickling pattern objects which is based on the way MIDI encodes variable-length integers, and I think it might have a use in a pickle protocol. In the basic format, an integer is split up into 7-bit chunks, each chunk put into a byte, and the