The goal of this enhancement is to make the shelve module more usable by accepting custom types of pickler and unpickler.
Example
The lambda functions can not be pickled by Python's pickle module. So, for that reason the shelve library also can’t do that.
The shelve module was unable to handle this situation.
importshelvewithshelve.open("test_file") assh:
squared=lambdax: x**2sh['test_key'] =squaredWith the changes made here, the shelve module can easily overcome this issue.
importdillimportshelvewithshelve.open("test_file_2", pickler=dill.Pickler, unpickler=dill.Unpickler) assh:
squared=lambdax: x**2sh['test_key'] =squaredPrevious discussion
Linked PRs
The goal of this enhancement is to make the shelve module more usable by accepting custom types of pickler and unpickler.
Example
The lambda functions can not be pickled by Python's pickle module. So, for that reason the shelve library also can’t do that.
The shelve module was unable to handle this situation.
With the changes made here, the shelve module can easily overcome this issue.
Previous discussion
Linked PRs