Currently with pickle you have to "open" the file separately from the pickle operation, generally using a "with" clause, then provide the file object to one of the pickle.dump or pickle.load.  This adds quite a bit of boilerplate for simply saving a file

I think it would be nice if pickle.dump and pickle.load would also accept a filename or path.  The functions would automatically open the file in the correct way, save/load the object, then close the file.  This would reduce the amount of code needed to save a single object by at least half, and would eliminate the incentive to use unsafe (I think?) approaches like opening within the dump or load, which the wiki still recommends [1].

So something like:

with open('myfile.p', 'wb') as f:
    pickle.dump(myobj, f)

Would be:

pickle.dump(myobj, 'myfile.p')

Sorry if this has already been discussed, but I searched the mailing list history and couldn't find it.