Update README.
This commit is contained in:
38
README.rst
38
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.
|
||||
|
||||
|
Reference in New Issue
Block a user