Clarify that __getinitargs__ is called at pickle time!

This commit is contained in:
Guido van Rossum 1997-12-30 17:44:48 +00:00
parent 4f80b65aa6
commit 5793039dce
2 changed files with 6 additions and 2 deletions

View File

@ -103,7 +103,9 @@ desirable to have a constructor that requires arguments; it is a
If it is desirable that the \code{__init__} method be called on
unpickling, a class can define a method \code{__getinitargs__()},
which should return a {\em tuple} containing the arguments to be
passed to the class constructor (\code{__init__()}).
passed to the class constructor (\code{__init__()}). This method is
called at pickle time; the tuple it returns is incorporated in the
pickle for the instance.
\ttindex{__getinitargs__}
\ttindex{__init__}

View File

@ -103,7 +103,9 @@ desirable to have a constructor that requires arguments; it is a
If it is desirable that the \code{__init__} method be called on
unpickling, a class can define a method \code{__getinitargs__()},
which should return a {\em tuple} containing the arguments to be
passed to the class constructor (\code{__init__()}).
passed to the class constructor (\code{__init__()}). This method is
called at pickle time; the tuple it returns is incorporated in the
pickle for the instance.
\ttindex{__getinitargs__}
\ttindex{__init__}