A pickle problem!

Ian Kelly ian.g.kelly at gmail.com
Fri Apr 22 16:33:39 EDT 2016


On Fri, Apr 22, 2016 at 2:21 PM, Paulo da Silva
<p_s_d_a_s_i_l_v_a_ns at netcabo.pt> wrote:
> Às 17:27 de 22-04-2016, Ian Kelly escreveu:
>> On Thu, Apr 21, 2016 at 7:52 PM, Paulo da Silva
>> <p_s_d_a_s_i_l_v_a_ns at netcabo.pt> wrote:
>>> Às 22:43 de 21-04-2016, Paulo da Silva escreveu:
> ...
>
>>
>> Probably this is necessary because the DataFrame class is already
>> customizing its pickle behavior without taking into account the
>> possibility of added attributes by subclasses. I think that your
>> solution of wrapping the state of the superclass looks fine.
>>
> Thank you.
>
> For any other vars ...
> Is there a way to get the vars of only the derived class?

If they start with two underscores then you could use the name
mangling to find them. If the class name is MyClass then look for any
keys in the instance dict that start with '_MyClass__'. Otherwise no,
you'd have to list them explicitly.



More information about the Python-list mailing list