[Python-Dev] Pickle alternative in stdlib (Was: On breaking modules into packages)

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Thu Nov 4 13:12:19 CET 2010


On 06:28 am, techtonik at gmail.com wrote:
>On Wed, Nov 3, 2010 at 9:08 PM, Glyph Lefkowitz 
><glyph at twistedmatrix.com> wrote:
>>
>>This is the strongest reason why I recommend to everyone I know that 
>>they
>>not use pickle for storage they'd like to keep working after upgrades 
>>[not
>>just of stdlib, but other 3rd party software or their own software]. 
>>:)
>>
>>+1.
>>Twisted actually tried to preserve pickle compatibility in the bad old 
>>days,
>>but it was impossible.  Pickles should never really be saved to disk 
>>unless
>>they contain nothing but lists, ints, strings, and dicts.
>
>But what is alternative in stdlib?
>Don't you think that Python doesn't provide any?

Persistence is a very hard problem.  Lots and lots of trade-offs need to 
be made, and you generally want to tailor those trade-offs to the 
particular application at hand.  This probably means that the stdlib 
isn't a suitable place to try to solve the problem.

Look outside the stdlib and you'll find an extremely vibrant and diverse 
collection of software which is aimed at solving this problem, though.

Jean-Paul


More information about the Python-Dev mailing list