decoding floats

Nico Hartmann nico.hartmann at daimlerchrysler.com
Fri Nov 30 02:17:58 EST 2001


Hi,

> >>> import marshal
> >>> s = marshal.dumps(3.14)
> >>> s
> 'f\x043.14'
  ^^^^^^^^^ Unfortunately this is clearly not the byte code of an IEEE
floating point value.

However, unless we don't intend to exchange data with other applications in
binary form,
that marshal interface looks quite simple but inefficient to me
(marshal.dumps(math.pi) takes 15 bytes).

Greets,
 nico





More information about the Python-list mailing list