The Codec class defines these methods which also define the function interfaces of the stateless encoder and decoder:
input[, errors]) |
cp1252
or
iso-8859-1
).
errors defines the error handling to apply. It defaults to
'strict'
handling.
The method may not store state in the Codec instance. Use StreamCodec for codecs which have to keep state in order to make encoding/decoding efficient.
The encoder must be able to handle zero length input and return an empty object of the output object type in this situation.
input[, errors]) |
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory mapped files
are examples of objects providing this slot.
errors defines the error handling to apply. It defaults to
'strict'
handling.
The method may not store state in the Codec instance. Use StreamCodec for codecs which have to keep state in order to make encoding/decoding efficient.
The decoder must be able to handle zero length input and return an empty object of the output object type in this situation.
The IncrementalEncoder and IncrementalDecoder classes provide the basic interface for incremental encoding and decoding. Encoding/decoding the input isn't done with one call to the stateless encoder/decoder function, but with multiple calls to the encode/decode method of the incremental encoder/decoder. The incremental encoder/decoder keeps track of the encoding/decoding process during method calls.
The joined output of calls to the encode/decode method is the same as if all the single inputs were joined into one, and this input was encoded/decoded with the stateless encoder/decoder.
See About this document... for information on suggesting changes.