Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Custom unpickler and pickler for the shelve module #99631

Closed
Assignees
furkanonder
Labels
stdlibPython modules in the Lib dirtype-featureA feature request or enhancement
@furkanonder

Description

@furkanonder

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']=squared

With the changes madehere, 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']=squared

Previous discussion

Linked PRs

Metadata

Metadata

Assignees

Labels

stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp