Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freeze() does not work on collections.defaultdict #280

Closed
connorjward opened this issue Oct 10, 2023 · 0 comments · Fixed by #281
Closed

freeze() does not work on collections.defaultdict #280

connorjward opened this issue Oct 10, 2023 · 0 comments · Fixed by #281

Comments

@connorjward
Copy link

The following code

import collections
from pyrsistent import freeze

mydict = collections.defaultdict(dict)
mydict["a"]["x"] = 2
mydict["a"]["y"] = 3
mydict["b"]["z"] = 4

frozen = freeze(mydict)
print(type(frozen))

prints <class 'collections.defaultdict'> rather than PMap as I would expect. In other words freeze does not do anything to a collections.defaultdict when I would expect it to make it a persistent map instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant