Skip to content

Conversation

@jpn--
Copy link

@jpn-- jpn-- commented Apr 8, 2021

This PR makes it so frozen Dict's can be copied and pickled. Addresses #136

>>> from addict import Dict
>>> a = Dict().copy()
>>> a.foo.bar
{}
>>> b = Dict(aaa=1, bbb=2)
>>> b.freeze()
>>> b.aaa == 1
True
>>> b.ccc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/addict/addict/addict.py", line 67, in __getattr__
    return self.__getitem__(item)
  File "/addict/addict/addict.py", line 71, in __missing__
    raise KeyError(name)
KeyError: 'ccc'
>>> c = b.copy()
>>> c.ddd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/addict/addict/addict.py", line 67, in __getattr__
    return self.__getitem__(item)
  File "/addict/addict/addict.py", line 71, in __missing__
    raise KeyError(name)
KeyError: 'ddd'
>>> 

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 03a9506 on jpn--:master into 75284f9 on mewwts:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 03a9506 on jpn--:master into 75284f9 on mewwts:master.

@schmoelder
Copy link

Is there a reason not to merge? I can confirm that it solves #136

@ma-sadeghi
Copy link

Any update on this?

stfujnkk pushed a commit to stfujnkk/addict that referenced this pull request Mar 29, 2025
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 this pull request may close these issues.

4 participants