[Python-Dev] Module renaming and pickle mechanisms

glyph at divmod.com glyph at divmod.com
Sun May 18 01:44:38 CEST 2008


On 10:22 pm, greg.ewing at canterbury.ac.nz wrote:
>When I brought this up earlier, various people assured
>me that it wasn't a problem in practice. I think we're
>seeing one situation here where it *is* a problem.

Just my two cents here - experience has taught me that it's definitely a 
problem in practice.  One big problem with pickle is that it's even 
difficult to tell when or how much your persistence format depends on 
your application code.  For example, if you're pickling a dict that is 
supposed to map strings to integers, but you have a bug which 
accidentally ends up using a string subclass instead, it can be very 
difficult to figure out that this ever happened.

pickletools is really neat, and can help with this problem once you're 
stuck, but it's a better idea to use a more explicit persistence 
mechanism in the first place if you can.


More information about the Python-Dev mailing list