8000 Update pickle.rst (GH-14128) · websurfer5/cpython@b099d62 · GitHub
[go: up one dir, main page]

Skip to content

Commit b099d62

Browse files
geryogamwebsurfer5
authored andcommitted
Update pickle.rst (pythonGH-14128)
* Edits for readability and grammar
1 parent 211d812 commit b099d62

File tree

1 file changed

+19
-17
lines changed
  • Doc/library

1 file changed

+19
-17
lines changed

Doc/library/pickle.rst

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ process more convenient:
197197

198198
.. function:: dump(obj, file, protocol=None, \*, fix_imports=True, buffer_callback=None)
199199

200-
Write a pickled representation of *obj* to the open :term:`file object` *file*.
201-
This is equivalent to ``Pickler(file, protocol).dump(obj)``.
200+
Write the pickled representation of the object *obj* to the open
201+
:term:`file object` *file*. This is equivalent to
202+
``Pickler(file, protocol).dump(obj)``.
202203

203204
Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have
204205
the same meaning as in the :class:`Pickler` constructor.
@@ -208,7 +209,7 @@ process more convenient:
208209

209210
.. function:: dumps(obj, protocol=None, \*, fix_imports=True, buffer_callback=None)
210211

211-
Return the pickled representation of the object as a :class:`bytes` object,
212+
Return the pickled representation of the object *obj* as a :class:`bytes` object,
212213
instead of writing it to a file.
213214

214215
Arguments *protocol*, *fix_imports* and *buffer_callback* have the same
@@ -219,13 +220,13 @@ process more convenient:
219220

220221
.. function:: load(file, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
221222

222-
Read a pickled object representation from the open :term:`file object`
223+
Read the pickled representation of an object from the open :term:`file object`
223224
*file* and return the reconstituted object hierarchy specified therein.
224225
This is equivalent to ``Unpickler(file).load()``.
225226

226227
The protocol version of the pickle is detected automatically, so no
227-
protocol argument is needed. Bytes past the pickled object's
228-
representation are ignored.
228+
protocol argument is needed. Bytes past the pickled representation
229+
of the object are ignored.
229230

230231
Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and *buffers*
231232
have the same meaning as in the :class:`Unpickler` constructor.
@@ -235,12 +236,12 @@ process more convenient:
235236

236237
.. function:: loads(bytes_object, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
237238

238-
Read a pickled object hierarchy from a :class:`bytes` object and return the
239-
reconstituted object hierarchy specified therein.
239+
Return the reconstituted object hierarchy of the pickled representation
240+
*bytes_object* of an object.
240241

241242
The protocol version of the pickle is detected automatically, so no
242-
protocol argument is needed. Bytes past the pickled object's
243-
representation are ignored.
243+
protocol argument is needed. Bytes past the pickled representation
244+
of the object are ignored.
244245

245246
Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and *buffers*
246247
have the same meaning as in the :class:`Unpickler` constructor.
@@ -311,7 +312,7 @@ The :mod:`pickle` module exports three classes, :class:`Pickler`,
311312

312313
.. method:: dump(obj)
313314

314-
Write a pickled representation of *obj* to the open file object given in
315+
Write the pickled representation of *obj* to the open file object given in
315316
the constructor.
316317

317318
.. method:: persistent_id(obj)
@@ -412,9 +413,10 @@ The :mod:`pickle` module exports three classes, :class:`Pickler`,
412413

413414
.. method:: load()
414415

415-
Read a pickled object representation from the open file object given in
416-
the constructor, and return the reconstituted object hierarchy specified
417-
therein. Bytes past the pickled object's representation are ignored.
416+
Read the pickled representation of an object from the open file object
417+
given in the constructor, and return the reconstituted object hierarchy
418+
specified therein. Bytes past the pickled representation of the object
419+
are ignored.
418420

419421
.. method:: persistent_load(pid)
420422

@@ -717,13 +719,13 @@ alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object (for
717719
any newer protocol).
718720

719721
The resolution of such persistent IDs is not defined by the :mod:`pickle`
720-
module; it will delegate this resolution to the user defined methods on the
722+
module; it will delegate this resolution to the user-defined methods on the
721723
pickler and unpickler, :meth:`~Pickler.persistent_id` and
722724
:meth:`~Unpickler.persistent_load` respectively.
723725

724-
To pickle objects that have an external persistent id, the pickler must have a
726+
To pickle objects that have an external persistent ID, the pickler must have a
725727
custom :meth:`~Pickler.persistent_id` method that takes an object as an
726-
argument and returns either ``None`` or the persistent id for that object.
728+
argument and returns either ``None`` or the persistent ID for that object.
727729
When ``None`` is returned, the pickler simply pickles the object as normal.
728730
When a persistent ID string is returned, the pickler will pickle that object,
729731
along with a marker so that the unpickler will recognize it as a persistent ID.

0 commit comments

Comments
 (0)
0