This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Pritish Patil, steven.daprano, yselivanov
Date 2017-09-01.15:06:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20170901150610.GD13110@ando.pearwood.info>
In-reply-to <1504277476.43.0.203831960923.issue31322@psf.upfronthosting.co.za>
Content
> 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 
example, the public interface for getting __dict__ is to call 
vars(namespace).

But there's no need to do this by hand. Use the copy module instead.

copy.copy(namespace)  # copy one level only

copy.deepcopy(namespace)  # copy all the way down

seem to work for me.

Does this solve your problem? If so, we'll close this issue.
History
Date User Action Args
2017-09-01 15:06:19steven.dapranosetrecipients: + steven.daprano, yselivanov, Pritish Patil
2017-09-01 15:06:19steven.dapranolinkissue31322 messages
2017-09-01 15:06:19steven.dapranocreate