diff options
author | INADA Naoki <inada-n@klab.com> | 2013-02-26 09:20:44 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2013-02-26 09:20:44 +0900 |
commit | 3ce005cf377eaeb5a517ce82698e4ae4381e67b9 (patch) | |
tree | b45eb1353b98b655803df23b8ec2486d0be02ce4 /msgpack/fallback.py | |
parent | 1e38bfa1235896f2df5d34211166276b48afa4b9 (diff) | |
download | msgpack-python-3ce005cf377eaeb5a517ce82698e4ae4381e67b9.tar.gz |
better packer docstring
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r-- | msgpack/fallback.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/msgpack/fallback.py b/msgpack/fallback.py index 28ce036..f9a2f5e 100644 --- a/msgpack/fallback.py +++ b/msgpack/fallback.py @@ -423,6 +423,30 @@ class Unpacker(object): class Packer(object): + """ + MessagePack Packer + + usage: + + packer = Packer() + astream.write(packer.pack(a)) + astream.write(packer.pack(b)) + + Packer's constructor has some keyword arguments: + + :param callable default: + Convert user type to builtin type that Packer supports. + See also simplejson's document. + :param str encoding: + Convert unicode to bytes with this encoding. (default: 'utf-8') + :param str unicode_erros: + Error handler for encoding unicode. (default: 'strict') + :param bool use_single_float: + Use single precision float type for float. (default: False) + :param bool autoreset: + Reset buffer after each pack and return it's content as `bytes`. (default: True). + If set this to false, use `bytes()` to get content and `.reset()` to clear buffer. + """ def __init__(self, default=None, encoding='utf-8', unicode_errors='strict', use_single_float=False, autoreset=True): self._use_float = use_single_float |