msgpack/msgpack-python — pull request #11 by TobiasSimon (2012-08-20 20:01:52+00:00)
Title: added float serialization support

This adds support to encode Python floats not only as double values, but also as floats, which requires less space in the packed structure. The double code is still standard, and the Packer can be customized using the use_float variable, as the following example shows:

from msgpack import Packer, unpackb
data = [0, 1.699, "x"]

double_packer = Packer()
double_packed = double_packer.pack(data)
print 'len of double packed data: ', len(double_packed)

float_packer = Packer(use_float = True)
float_packed = float_packer.pack(data)
print 'len of float packed data: ', len(float_packed)