[issue31322] SimpleNamespace deep copy

2017-09-01 Thread Pritish Patil
Pritish Patil added the comment: Yes. copy.deepcopy() works. Didn't think of it! -- stage: -> resolved status: open -> closed ___ Python tracker ___ __

[issue31322] SimpleNamespace deep copy

2017-09-01 Thread Eric Snow
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 namespa

[issue31322] SimpleNamespace deep copy

2017-09-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: > When using nested SimpleNamespaces, a making a copy by using > > new_NS=SimpleNamespace(**namespace.__dict__.copy()) In general, you shouldn't call or directly access dunder attributes. There are exceptions, but generally they're for Python's use only. For

[issue31322] SimpleNamespace deep copy

2017-09-01 Thread Pritish Patil
Changes by Pritish Patil : -- nosy: +yselivanov -docs@python ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue31322] SimpleNamespace deep copy

2017-09-01 Thread Pritish Patil
Changes by Pritish Patil : -- components: +Extension Modules -Documentation, Library (Lib) ___ Python tracker ___ ___ Python-bugs-list

[issue31322] SimpleNamespace deep copy

2017-09-01 Thread Pritish Patil
New submission from Pritish Patil: I am new here and not sure how I can suggest this properly. When using nested SimpleNamespaces, a making a copy by using new_NS=SimpleNamespace(**namespace.__dict__.copy()) only copies the highest level namespace. This is expected in python as shallow copi