@@ -3,8 +3,8 @@ MessagePack for Python
3
3
=======================
4
4
5
5
:author: INADA Naoki
6
- :version: 0.3 .0
7
- :date: 2012-12-07
6
+ :version: 0.4 .0
7
+ :date: 2013-10-21
8
8
9
9
.. image :: https://secure.travis-ci.org/msgpack/msgpack-python.png
10
10
: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.)
39
39
40
40
Without extension, using pure python implementation on CPython runs slowly.
41
41
42
+ Notes
43
+ -----
44
+
45
+ Note for msgpack 2.0 support
46
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47
+
48
+ msgpack 2.0 adds two types: *bin * and *ext *.
49
+
50
+ *raw * was bytes or string type like Python 2's ``str ``.
51
+ To distinguish string and bytes, msgpack 2.0 adds *bin *.
52
+ It is non-string binary like Python 3's ``bytes ``.
53
+
54
+ To use *bin * type for packing ``bytes ``, pass ``use_bin_type=True `` to
55
+ packer argument.
56
+
57
+ >>> import msgpack
58
+ >>> packed = msgpack.packb([b ' spam' , u ' egg' ], use_bin_type = True )
59
+ >>> msgpack.unpackb(packed, encoding = ' utf-8' )
60
+ ['spam', u'egg']
61
+
62
+ You shoud use it carefully. When you use ``use_bin_type=True ``, packed
63
+ binary can be unpacked by unpackers supporting msgpack-2.0.
64
+
65
+ To use *ext * type, pass ``msgpack.ExtType `` object to packer.
66
+
67
+ >>> import msgpack
68
+ >>> packed = msgpack.packb(msgpack.ExtType(42 , b ' xyzzy' ))
69
+ >>> msgpack.unpackb(packed)
70
+ ExtType(code=42, data='xyzzy')
71
+
72
+ You can use it with ``default `` and ``ext_hook ``. See below.
73
+
42
74
Note for msgpack 0.2.x users
43
- ----------------------------
75
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
76
45
77
The msgpack 0.3 have some incompatible changes.
46
78
0 commit comments