Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteb19c45

Browse files
miss-islingtongeryogam
authored andcommitted
Doc: Update pickle.rst (GH-14128) (GH-16014)
* Edits for readability and grammar(cherry picked from commit362f535)Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
1 parent2bb6bf0 commiteb19c45

File tree

1 file changed

+19
-17
lines changed

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
@@ -211,8 +211,9 @@ process more convenient:
211211

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

214-
Write a pickled representation of *obj* to the open:term:`file object` *file*.
215-
This is equivalent to ``Pickler(file, protocol).dump(obj)``.
214+
Write the pickled representation of the object *obj* to the open
215+
:term:`file object` *file*. This is equivalent to
216+
``Pickler(file, protocol).dump(obj)``.
216217

217218
Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have
218219
the same meaning as in the:class:`Pickler` constructor.
@@ -222,7 +223,7 @@ process more convenient:
222223

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

225-
Return the pickled representation of the object as a:class:`bytes` object,
226+
Return the pickled representation of the object*obj*as a:class:`bytes` object,
226227
instead of writing it to a file.
227228

228229
Arguments *protocol*, *fix_imports* and *buffer_callback* have the same
@@ -233,13 +234,13 @@ process more convenient:
233234

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

236-
Reada pickledobjectrepresentation from the open:term:`file object`
237+
Readthe pickled representation of an object from the open:term:`file object`
237238
*file* and return the reconstituted object hierarchy specified therein.
238239
This is equivalent to ``Unpickler(file).load()``.
239240

240241
The protocol version of the pickle is detected automatically, so no
241-
protocol argument is needed. Bytes past the pickledobject's
242-
representation are ignored.
242+
protocol argument is needed. Bytes past the pickledrepresentation
243+
of the object are ignored.
243244

244245
Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and *buffers*
245246
have the same meaning as in the:class:`Unpickler` constructor.
@@ -249,12 +250,12 @@ process more convenient:
249250

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

252-
Read a pickled object hierarchyfrom a:class:`bytes` object and return the
253-
reconstituted object hierarchy specified therein.
253+
Return the reconstituted object hierarchyof the pickled representation
254+
*bytes_object* of an object.
254255

255256
The protocol version of the pickle is detected automatically, so no
256-
protocol argument is needed. Bytes past the pickledobject's
257-
representation are ignored.
257+
protocol argument is needed. Bytes past the pickledrepresentation
258+
of the object are ignored.
258259

259260
Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and *buffers*
260261
have the same meaning as in the:class:`Unpickler` constructor.
@@ -325,7 +326,7 @@ The :mod:`pickle` module exports three classes, :class:`Pickler`,
325326

326327
..method::dump(obj)
327328

328-
Writea pickled representation of *obj* to the open file object given in
329+
Writethe pickled representation of *obj* to the open file object given in
329330
the constructor.
330331

331332
..method::persistent_id(obj)
@@ -426,9 +427,10 @@ The :mod:`pickle` module exports three classes, :class:`Pickler`,
426427

427428
..method::load()
428429

429-
Read a pickled object representation from the open file object given in
430-
the constructor, and return the reconstituted object hierarchy specified
431-
therein. Bytes past the pickled object's representation are ignored.
430+
Read the pickled representation of an object from the open file object
431+
given in the constructor, and return the reconstituted object hierarchy
432+
specified therein. Bytes past the pickled representation of the object
433+
are ignored.
432434

433435
..method::persistent_load(pid)
434436

@@ -731,13 +733,13 @@ alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object (for
731733
any newer protocol).
732734

733735
The resolution of such persistent IDs is not defined by the:mod:`pickle`
734-
module; it will delegate this resolution to the userdefined methods on the
736+
module; it will delegate this resolution to the user-defined methods on the
735737
pickler and unpickler,:meth:`~Pickler.persistent_id` and
736738
:meth:`~Unpickler.persistent_load` respectively.
737739

738-
To pickle objects that have an external persistentid, the pickler must have a
740+
To pickle objects that have an external persistentID, the pickler must have a
739741
custom:meth:`~Pickler.persistent_id` method that takes an object as an
740-
argument and returns either ``None`` or the persistentid for that object.
742+
argument and returns either ``None`` or the persistentID for that object.
741743
When ``None`` is returned, the pickler simply pickles the object as normal.
742744
When a persistent ID string is returned, the pickler will pickle that object,
743745
along with a marker so that the unpickler will recognize it as a persistent ID.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp