Runtime Utility Methods

types.MappingProxyType.copy()

Return a shallow ordinary dictionary copy of the proxied mapping (for a dict backing). Subsequent key changes in the original dict are not reflected in the copy.

Formal Syntax & Structure

python syntaxpython
proxy.copy()

Return Value

mapping-dependent object

Shallow copy returned by the wrapped mapping’s copy() method; normally dict for dictionary backing.

Working Example

Example Snippetpython
import typesd={"x":1}; p=types.MappingProxyType(d); c=p.copy(); d["x"]=2print(c["x"],p["x"])
Python Reference