Eric Snow added the comment:
Hmm. What problems are you seeing with deep copies? copy.deepcopy() should
work since SimpleNamespace is picklable. [1][2] I don't have any problems:
>>> import types, copy
>>> ns = types.SimpleNamespace(x=1, y=2)
>>> copied = copy.deepcopy(ns)
>>> copied
namespace(x=1, y=2)
>>> ns = types.SimpleNamespace(x=types.SimpleNamespace(a=1),
y=types.SimpleNamespace(b=2))
>>> copied = copy.deepcopy(ns)
>>> copied
namespace(x=namespace(a=1), y=namespace(b=2))
>>> ns.x is copied.x
False
[1] issue #15022
[2] https://docs.python.org/3/library/copy.html
----------
nosy: +eric.snow
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue31322>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com