summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2013-10-21 00:01:47 +0900
committerINADA Naoki <inada-n@klab.com>2013-10-21 00:01:47 +0900
commitcb789596787592f4ec6bf7dcc0c646e8976b3f16 (patch)
treec9eb2fe02f4e26de5f433ba478757284d5dceb06
parent84dc99c894be82b7a8c3708a3554888a6133b33b (diff)
downloadmsgpack-python-cb789596787592f4ec6bf7dcc0c646e8976b3f16.tar.gz
Update README.
-rw-r--r--README.rst38
1 files changed, 35 insertions, 3 deletions
diff --git a/README.rst b/README.rst
index 99fb923..c51e518 100644
--- a/README.rst
+++ b/README.rst
@@ -3,8 +3,8 @@ MessagePack for Python
=======================
:author: INADA Naoki
-:version: 0.3.0
-:date: 2012-12-07
+:version: 0.4.0
+:date: 2013-10-21
.. image:: https://secure.travis-ci.org/msgpack/msgpack-python.png
:target: https://travis-ci.org/#!/msgpack/msgpack-python
@@ -39,8 +39,40 @@ amd64. Windows SDK is recommanded way to build amd64 msgpack without any fee.)
Without extension, using pure python implementation on CPython runs slowly.
+Notes
+-----
+
+Note for msgpack 2.0 support
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+msgpack 2.0 adds two types: *bin* and *ext*.
+
+*raw* was bytes or string type like Python 2's ``str``.
+To distinguish string and bytes, msgpack 2.0 adds *bin*.
+It is non-string binary like Python 3's ``bytes``.
+
+To use *bin* type for packing ``bytes``, pass ``use_bin_type=True`` to
+packer argument.
+
+ >>> import msgpack
+ >>> packed = msgpack.packb([b'spam', u'egg'], use_bin_type=True)
+ >>> msgpack.unpackb(packed, encoding='utf-8')
+ ['spam', u'egg']
+
+You shoud use it carefully. When you use ``use_bin_type=True``, packed
+binary can be unpacked by unpackers supporting msgpack-2.0.
+
+To use *ext* type, pass ``msgpack.ExtType`` object to packer.
+
+ >>> import msgpack
+ >>> packed = msgpack.packb(msgpack.ExtType(42, b'xyzzy'))
+ >>> msgpack.unpackb(packed)
+ ExtType(code=42, data='xyzzy')
+
+You can use it with ``default`` and ``ext_hook``. See below.
+
Note for msgpack 0.2.x users
-----------------------------
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The msgpack 0.3 have some incompatible changes.