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

Chris Rebert pyideas at rebertia.com
Tue Nov 23 23:18:23 CET 2010


On Tue, Nov 23, 2010 at 12:25 PM, Éric Araujo <merwok at netwok.org> wrote:
> Hi,
>
>> Recently I had the need to filter objects based on whether they're picklable
>> or not:
>>
>> http://stackoverflow.com/questions/4080688/python-pickling-a-dict-with-some-unpicklable-items
>>
>> I'm not sure what's a good way to check for a specific object whether it's
>> picklable.
>>
>> <http://stackoverflow.com/questions/4080688/python-pickling-a-dict-with-some-unpicklable-items>This
>> led me to think: Maybe we should have an `Unpicklable` abstract base class
>> in the `collections` module? Then various unpicklable classes, like locks,
>> files or widgets, could inherit from this class to signify that they cannot
>> be pickled.
>>
>> What do you think?
>
> This sounds useful.  I’d rather spell the ABC pickle.Picklable, though.

Indeed; let's not turn the `collections` module into a repository of
miscellaneous ABCs.
I'm looking at you, collections.Callable!

Cheers,
Chris
--
Burn the witch!
http://blog.rebertia.com



More information about the Python-ideas mailing list