diff options
author | Guido van Rossum <guido@python.org> | 1996-08-08 18:35:22 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-08-08 18:35:22 (GMT) |
commit | 37a6f16d2ec04facf3225e05972b42ed7ece1407 (patch) | |
tree | 6dca6957249ba7e7583591f8ca9bc50e72295bc7 /Lib | |
parent | 4033ad7576713fea34ec34f9922d26d972358178 (diff) | |
download | cpython-37a6f16d2ec04facf3225e05972b42ed7ece1407.zip cpython-37a6f16d2ec04facf3225e05972b42ed7ece1407.tar.gz cpython-37a6f16d2ec04facf3225e05972b42ed7ece1407.tar.bz2 |
Slight update of doc string -- suggest default args for __init__, no
longer complain that __getinitargs__ is an ugly name.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/pickle.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index dde3dee..a481fc7 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -56,10 +56,12 @@ There are some restrictions on the pickling of class instances. First of all, the class must be defined at the top level in a module. -Next, it must normally be possible to create class instances by calling -the class without arguments. If this is undesirable, the class can -define a method __getinitargs__ (XXX not a pretty name!), which should -return a *tuple* containing the arguments to be passed to the class +Next, it must normally be possible to create class instances by +calling the class without arguments. Usually, this is best +accomplished by providing default values for all arguments to its +__init__ method (if it has one). If this is undesirable, the +class can define a method __getinitargs__, which should return a +*tuple* containing the arguments to be passed to the class constructor. Classes can influence how their instances are pickled -- if the class defines |