BERT serializer for your Pythons.
$ apt-get install python-dev
$ pip install beretta
import beretta
binary = beretta.encode([{'key': 'value'}, 42]) # => b'\x83l\x00...'
beretta.decode(binary) # => [{'key': 'value'}, 42]
data = [0 for _ in range(1024)]
compressed = beretta.encode(data, compressed=6)
assert len(compressed) < len(beretta.encode(data))
Type | Python | BERT |
Time | datetime.datetime | {bert, time, Megaseconds, Seconds, Microseconds} |
Dictionary | dict | {bert, dict, KeysAndValues} |
Boolean | True or False | {bert, true} or {bert, false} |
Nil | None | {bert, nil} |
Regex | re.compile | {bert, regex, Source, Options} |