2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 05:02:17 +00:00

More comments.

[SVN r9553]
This commit is contained in:
Ralf W. Grosse-Kunstleve
2001-03-13 00:24:38 +00:00
parent 33aac2ec83
commit 9e41737b68
3 changed files with 30 additions and 0 deletions

View File

@@ -1,5 +1,10 @@
/*
This example shows how to make an Extension Class "pickleable".
The world class below can be fully restored by passing the
appropriate argument to the constructor. Therefore it is sufficient
to define the pickle interface method __getinitargs__.
For more information refer to boost/libs/python/doc/pickle.html.
*/

View File

@@ -1,5 +1,20 @@
/*
This example shows how to make an Extension Class "pickleable".
The world class below contains member data (secret_number) that
cannot be restored by any of the constructors. Therefore it is
necessary to provide the __getstate__/__setstate__ pair of pickle
interface methods.
For simplicity, the __dict__ is not included in the result of
__getstate__. This is not generally recommended, but a valid
approach if it is anticipated that the object's __dict__ will
always be empty. Note that safety guard are provided to catch the
cases where this assumption is not true.
pickle3.cpp shows how to include the object's __dict__ in the
result of __getstate__.
For more information refer to boost/libs/python/doc/pickle.html.
*/

View File

@@ -1,5 +1,15 @@
/*
This example shows how to make an Extension Class "pickleable".
The world class below contains member data (secret_number) that
cannot be restored by any of the constructors. Therefore it is
necessary to provide the __getstate__/__setstate__ pair of pickle
interface methods.
The object's __dict__ is included in the result of __getstate__.
This requires more code (compare with pickle2.cpp), but is
unavoidable if the object's __dict__ is not always empty.
For more information refer to boost/libs/python/doc/pickle.html.
*/