Packer is the class for packing data into XDR representation. The Packer class is instantiated with no arguments.
In general, you can pack any of the most common XDR data types by calling the appropriate pack_type method. Each method takes a single argument, the value to pack. The following simple data type packing methods are supported: pack_uint, pack_int, pack_enum, pack_bool, pack_uhyper, and pack_hyper.
The following methods pack floating point numbers, however they require C library support. Without the optional C built-in module, both of these methods will raise an xdrlib.ConversionError exception. See the note at the end of this chapter for details.
The following methods support packing strings, bytes, and opaque data:
The following methods support packing arrays and lists: