[Python-3000] Is pickle's persistent_id worth keeping?

Jim Fulton jim at zope.com
Sun Jan 6 19:35:42 CET 2008

(Note that Alexandre called this thread to my attention.  I wish I had  
more time to pay attention to this list.)

On Jan 5, 2008, at 6:50 PM, Alexandre Vassalotti wrote:

> Hi,
> I currently trying to clean up the interface of the pickle module for
> Python 3K. So far, I haven't done much, except documenting parts the
> pickle stream format.
> There's still one thing I still don't understand about pickle,
> persistent_id. I haven't found any useful use-cases for it. Using
> Google's code search, only Zope (or variant of) seems to have found
> some obscure way to use it. (Is there a Python feature Zope doesn't
> use? <wink>) Personally, I think persistent_id is just a remnant of
> the older protocol, which didn't memoize object.

Pickle always memoized objects.  persistent_id is useful for  
separating data over multiple pickles as is done in a database.  IOW,  
as its name implies, it is primarily useful for persistence systems.   
I don't think that ZODB is the only persistence system built on  
pickle, but perhaps I'm wrong.

I  suspect ZODB is also the primary user of the pickle module.

> So, would it be okay to remove it from the next version of the  
> protocol?

Well, that would break ZODB (and a few other Zope applications).  I  
think it would break other applications too. Ultimately, it would  
cause a fork.  There would be the version that we use and the version  
that everyone else uses.  I'm not sure that that would be the end of  
the world, OTOH, I don't think it would be a terribly good thing either.

Really, I'd like to see a much smaller standard library.  IMO, pickle  
isn't essential enough to be part of the standard library and I'd be  
happy to see pickle become a separate project. I'd prefer to see most  
of the Python 2 standard library become separate projects.


Jim Fulton
Zope Corporation

More information about the Python-3000 mailing list