diff options
author | Guido van Rossum <guido@python.org> | 1996-08-09 21:23:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-08-09 21:23:47 (GMT) |
commit | 12f0cc325a0cf5057f6d3563cfcb6ac243a44582 (patch) | |
tree | 69cd9599b9a5f53872755d17a8ad5a967371ca03 /Doc/lib/libpickle.tex | |
parent | 4a5b27b525a0cf6423edf5abe7e192355510c976 (diff) | |
download | cpython-12f0cc325a0cf5057f6d3563cfcb6ac243a44582.zip cpython-12f0cc325a0cf5057f6d3563cfcb6ac243a44582.tar.gz cpython-12f0cc325a0cf5057f6d3563cfcb6ac243a44582.tar.bz2 |
Suggest using default values for __init__ arguments to make classes
unpicklable.
Diffstat (limited to 'Doc/lib/libpickle.tex')
-rw-r--r-- | Doc/lib/libpickle.tex | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/lib/libpickle.tex b/Doc/lib/libpickle.tex index 579992f..128b29d 100644 --- a/Doc/lib/libpickle.tex +++ b/Doc/lib/libpickle.tex @@ -86,7 +86,9 @@ First of all, the class must be defined at the top level in a module. \renewcommand{\indexsubitem}{(pickle protocol)} Next, it must normally be possible to create class instances by -calling the class without arguments. If this is undesirable, the +calling the class without arguments. Usually, this is best +accomplished by providing default values for all arguments to its +\code{__init__} method (if it has one). If this is undesirable, the 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__()}). |