diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-15 11:11:28 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-15 11:11:28 (GMT) |
commit | 11cb961b38550443d287b2b55174e504c2309af2 (patch) | |
tree | 51b2972800e593dde1b5f5154b9b044058a350d7 /Doc/library/pickle.rst | |
parent | 6a11a98b7c8f576d7663182cbd09123eb108a928 (diff) | |
download | cpython-11cb961b38550443d287b2b55174e504c2309af2.zip cpython-11cb961b38550443d287b2b55174e504c2309af2.tar.gz cpython-11cb961b38550443d287b2b55174e504c2309af2.tar.bz2 |
Add cross-references to the glossary entry for file objects.
Diffstat (limited to 'Doc/library/pickle.rst')
-rw-r--r-- | Doc/library/pickle.rst | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index 99e30c6..5e5d0a3 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -143,8 +143,8 @@ process more convenient: .. function:: dump(obj, file, protocol=None, \*, fix_imports=True) - Write a pickled representation of *obj* to the open file object *file*. This - is equivalent to ``Pickler(file, protocol).dump(obj)``. + Write a pickled representation of *obj* to the open :term:`file object` *file*. + This is equivalent to ``Pickler(file, protocol).dump(obj)``. The optional *protocol* argument tells the pickler to use the given protocol; supported protocols are 0, 1, 2, 3. The default protocol is 3; a @@ -155,8 +155,9 @@ process more convenient: Python needed to read the pickle produced. The *file* argument must have a write() method that accepts a single bytes - argument. It can thus be a file object opened for binary writing, a - io.BytesIO instance, or any other custom object that meets this interface. + argument. It can thus be an on-disk file opened for binary writing, a + :class:`io.BytesIO` instance, or any other custom object that meets this + interface. If *fix_imports* is True and *protocol* is less than 3, pickle will try to map the new Python 3.x names to the old module names used in Python 2.x, @@ -181,8 +182,8 @@ process more convenient: .. function:: load(file, \*, fix_imports=True, encoding="ASCII", errors="strict") - Read a pickled object representation from the open file object *file* and - return the reconstituted object hierarchy specified therein. This is + Read a pickled object representation from the open :term:`file object` *file* + and return the reconstituted object hierarchy specified therein. This is equivalent to ``Unpickler(file).load()``. The protocol version of the pickle is detected automatically, so no protocol @@ -191,9 +192,9 @@ process more convenient: The argument *file* must have two methods, a read() method that takes an integer argument, and a readline() method that requires no arguments. Both - methods should return bytes. Thus *file* can be a binary file object opened - for reading, a BytesIO object, or any other custom object that meets this - interface. + methods should return bytes. Thus *file* can be an on-disk file opened + for binary reading, a :class:`io.BytesIO` object, or any other custom object + that meets this interface. Optional keyword arguments are *fix_imports*, *encoding* and *errors*, which are used to control compatiblity support for pickle stream generated @@ -260,8 +261,8 @@ The :mod:`pickle` module exports two classes, :class:`Pickler` and Python needed to read the pickle produced. The *file* argument must have a write() method that accepts a single bytes - argument. It can thus be a file object opened for binary writing, a - io.BytesIO instance, or any other custom object that meets this interface. + argument. It can thus be an on-disk file opened for binary writing, a + :class:`io.BytesIO` instance, or any other custom object that meets this interface. If *fix_imports* is True and *protocol* is less than 3, pickle will try to map the new Python 3.x names to the old module names used in Python 2.x, @@ -304,9 +305,9 @@ The :mod:`pickle` module exports two classes, :class:`Pickler` and The argument *file* must have two methods, a read() method that takes an integer argument, and a readline() method that requires no arguments. Both - methods should return bytes. Thus *file* can be a binary file object opened - for reading, a BytesIO object, or any other custom object that meets this - interface. + methods should return bytes. Thus *file* can be an on-disk file object opened + for binary reading, a :class:`io.BytesIO` object, or any other custom object + that meets this interface. Optional keyword arguments are *fix_imports*, *encoding* and *errors*, which are used to control compatiblity support for pickle stream generated |