[Python-ideas] Adding `Unpicklable` to the `collections` module

Ram Rachum cool-rr at cool-rr.com
Sun Nov 28 23:49:57 CET 2010


Terry Reedy <tjreedy at ...> writes:

> 
> 
> >      > Why not `pickle.Incompatible`? It's not like the ABC has anything
> 
> >     pickle.Indigestable?
> >
> >
> > Undigestable surely...
> 
> I agree with putting whatever in the pickle module.
> 
> If there were ever demand for json.Incompatible or whatever, there we 
> have it.
> 

I think that naming it `pickle.Incompatible` would be the best indeed. The 
reason I wanted to avoid having a positive `Pickleable` class is that people 
might think that if something is an instance of it then it's pickleable, which 
is false, since a list is "inherently pickleable" but a list containing a lock 
object is not pickleable.

So I think it will be best to have both a `pickle.Incompatible` and a 
`pickle.Compatible`. The reason to have the negative is to let people inherit 
from it, the reason to have the positive is to make `isinstance` calls more 
natural. (i.e. avoid a double negative.)

What do you think?


Ram.




More information about the Python-ideas mailing list