[docs] pickle docs - what can be pickled

Georg Brandl georg at python.org
Tue Jan 1 16:54:02 CET 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/01/2013 04:37 PM, Eli Bendersky wrote:
> 
> 
> 
> On Tue, Jan 1, 2013 at 7:09 AM, Georg Brandl <georg at python.org 
> <mailto:georg at python.org>> wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
> 
> On 01/01/2013 01:28 AM, Eli Bendersky wrote:
>> In the pickle docs of 3.3, section 12.4.1 says:
>> 
>> "instances of such classes whose __dict__ or __setstate__() is
>> picklable"
>> 
>> Does it actually mean __setstate__ or __getstate__ ?
> 
> ISTM __setstate__ is correct, since that's the method that has to be looked
> up at unpickling time.  (__getstate__ is called at pickling time.)
> 
> 
> Yes, __getstate__ is called at pickling time, which is precisely why it
> should replace __setstate__ in the quoted statement, IMHO. Note that the
> doc of __getstate__ says:

You're right.  To be clear, the docs should talk about "whose __dict__ or the
result of calling __getstate__() can be pickled".

Georg

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEARECAAYFAlDjBpkACgkQN9GcIYhpnLDIBwCdFN3gQAkSQVi2a2UxYpgslq5V
378AoI/mcpAQxvkCiR3CdGBbRBVXAOPQ
=2PyJ
-----END PGP SIGNATURE-----


More information about the docs mailing list