summaryrefslogtreecommitdiff
path: root/msgpack/fallback.py
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2013-02-26 09:20:44 +0900
committerINADA Naoki <inada-n@klab.com>2013-02-26 09:20:44 +0900
commit3ce005cf377eaeb5a517ce82698e4ae4381e67b9 (patch)
treeb45eb1353b98b655803df23b8ec2486d0be02ce4 /msgpack/fallback.py
parent1e38bfa1235896f2df5d34211166276b48afa4b9 (diff)
downloadmsgpack-python-3ce005cf377eaeb5a517ce82698e4ae4381e67b9.tar.gz
better packer docstring
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r--msgpack/fallback.py24
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