Skip to content

Adding pickle.load and pickle.loads into cloudpickle namespace #36

@parnmatt

Description

@parnmatt

I understand that you do not include an unpickler:

It does not include an unpickler, as standard python unpickling suffices.

However it would be convenient if injecting the pickle load() and loads() methods into your name space, thus it can be used as a drop in.

You have import pickle surely it's almost a simple as:

    load = pickle.load
    loads = pickle.loads

If I am honest, I am a little inconvenient to have to write:

    try:
        import cPickle as pickle
    except ImportError:
        import pickle

    import cloudpickle

when I need to read and write pickled files/objects etc., and have to remember to use cloudpickle.dump[s]() and pickle.load[s]().

Just having those functions in your namespace, just redirecting the work to pickle itself would make code cleaner, can therefore can be used as a drop in replacement:

    import cloudpickle as pickle

This is common practise with an alternative pickler dill:

    import dill as pickle

dill is great, but I have found that cloudpickle can pickle something I need that dill cannot.

I wouldn't mind even doing it myself if need be; however rather than doing the work (which may not be as simple as stated above), creating a pull request, and it being rejected because you do not want this feature; I thought I would ask first.

Is this something that you would be interested in doing yourselves, or accepting an pull request for? or am I barking up the wrong tree?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions