8000 docs/library/marshal: Document the marshal module. · sparkfun/micropython@e40a3fd · GitHub
[go: up one dir, main page]

Skip to content

Commit e40a3fd

Browse files
committed
docs/library/marshal: Document the marshal module.
Signed-off-by: Damien George <damien@micropython.org>
1 parent c3a18d7 commit e40a3fd

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

docs/library/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ library.
6969
heapq.rst
7070
io.rst
7171
json.rst
72+
marshal.rst
7273
math.rst
7374
os.rst
7475
platform.rst

docs/library/marshal.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
:mod:`marshal` -- Python object serialization
2+
=============================================
3+
4+
.. module:: marshal
5+
:synopsis: Convert Python objects to and from a binary format
6+
7+
|see_cpython_module| :mod:`python:marshal`.
8+
9+
This module implements conversion between Python objects and a binary format.
10+
The format is specific to MicroPython but does not depend on the machine
11+
architecture, so the data can be transferred and used on a different MicroPython
12+
instance, as long as the version of the binary data matches (it's currently
13+
versioned as the mpy file version, see :ref:`mpy_files`).
14+
15+
Functions
16+
---------
17+
18+
.. function:: dumps(value, /)
19+
20+
Convert the given *value* to binary format and return a corresponding ``bytes``
21+
object.
22+
23+
Currently, code objects are the only supported values that can be converted.
24+
25+
.. function:: loads(data, /)
26+
27+
Convert the given bytes-like *data* to its corresponding Python object, and
28+
return it.

0 commit comments

Comments
 (0)
0