Commit 2ee01ecf authored by Mandeep Singh's avatar Mandeep Singh Committed by Mariatta

[2.7] bpo-22392: Improve documentation for __getinitargs__ (GH-899)

parent d694a062
...@@ -418,10 +418,11 @@ Pickling and unpickling normal class instances ...@@ -418,10 +418,11 @@ Pickling and unpickling normal class instances
When a pickled class instance is unpickled, its :meth:`__init__` method is When a pickled class instance is unpickled, its :meth:`__init__` method is
normally *not* invoked. If it is desirable that the :meth:`__init__` method normally *not* invoked. If it is desirable that the :meth:`__init__` method
be called on unpickling, an old-style class can define a method be called on unpickling, an old-style class can define a method
:meth:`__getinitargs__`, which should return a *tuple* containing the :meth:`__getinitargs__`, which should return a *tuple* of positional
arguments to be passed to the class constructor (:meth:`__init__` for arguments to be passed to the class constructor (:meth:`__init__` for
example). The :meth:`__getinitargs__` method is called at pickle time; the example). Keyword arguments are not supported. The :meth:`__getinitargs__`
tuple it returns is incorporated in the pickle for the instance. method is called at pickle time; the tuple it returns is incorporated in the
pickle for the instance.
.. method:: object.__getnewargs__() .. method:: object.__getnewargs__()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment