@@ -374,8 +374,8 @@ The :mod:`pickle` module exports two classes, :class:`Pickler` and
374
374
can optionally return ``NotImplemented `` to fallback on
375
375
:attr: `dispatch_table `-registered reducers to pickle ``obj ``.
376
376
377
- For a detailed example on how to use :meth: `~Pickler.reducer_override `, see:
378
- :ref: `reducer_override `.
377
+ For a detailed example on how to use :meth: `~Pickler.reducer_override `,
378
+ see: :ref: `reducer_override `.
379
379
380
380
.. versionadded :: 3.8
381
381
@@ -743,21 +743,23 @@ share the same dispatch table. The equivalent code using the
743
743
Subclassing the ``Pickler `` class
744
744
---------------------------------
745
745
746
- For most use-cases, it is recommended to simply use the :attr: `~Pickler.dispatch_table ` of a
747
- :class: `Pickler ` instance to customize its behavior, as explained above.
746
+ For most use-cases, it is recommended to simply use the
747
+ :attr: `~Pickler.dispatch_table ` of a :class: `Pickler ` instance to customize its
748
+ behavior, as explained above.
748
749
749
- However, using the :attr: `~Pickler.dispatch_table ` may not be flexible enough. In particular
750
- we may want to customize the pickling logic based on another criterion than the
751
- object's type, or we may want to customize the pickling of functions and
752
- classes.
750
+ However, using the :attr: `~Pickler.dispatch_table ` may not be flexible enough.
751
+ In particular we may want to customize the pickling logic based on another
752
+ criterion than the object's type, or we may want to customize the pickling of
753
+ functions and classes.
753
754
754
755
For those cases, it is possible to subclass from the :class: `Pickler ` class and
755
- implement a :meth: `~Pickler.reducer_override ` method. This method can return an arbitrary
756
- reduction tuple (see :meth: `__reduce__ `). It can alternatively return
756
+ implement a :meth: `~Pickler.reducer_override ` method. This method can return an
757
+ arbitrary reduction tuple (see :meth: `__reduce__ `). It can alternatively return
757
758
``NotImplemented `` to fallback to the traditional behavior.
758
759
759
- If both the :attr: `~Pickler.dispatch_table ` and :meth: `~Pickler.reducer_override ` are defined, then
760
- the :meth: `~Pickler.reducer_override ` method takes priority.
760
+ If both the :attr: `~Pickler.dispatch_table ` and
761
+ :meth: `~Pickler.reducer_override ` are defined, then the
762
+ :meth: `~Pickler.reducer_override ` method takes priority.
761
763
762
764
.. Note ::
763
765
For performance reasons, the C implementation of pickle does not allow to
0 commit comments