summaryrefslogtreecommitdiffstats
path: root/Lib/copy.py
diff options
context:
space:
mode:
authorMax Muoto <maxmuoto@gmail.com>2024-07-03 15:03:56 (GMT)
committerGitHub <noreply@github.com>2024-07-03 15:03:56 (GMT)
commit7c66906802cd8534b05264bd47acf9eb9db6d09e (patch)
tree1633313f415710b8e90179ae376497ab34b0ad4b /Lib/copy.py
parentca2e8765009d0d3eb9fe6c75465825c50808f4dd (diff)
downloadcpython-7c66906802cd8534b05264bd47acf9eb9db6d09e.zip
cpython-7c66906802cd8534b05264bd47acf9eb9db6d09e.tar.gz
cpython-7c66906802cd8534b05264bd47acf9eb9db6d09e.tar.bz2
gh-121300: Add `replace` to `copy.__all__` (#121302)
Diffstat (limited to 'Lib/copy.py')
-rw-r--r--Lib/copy.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index 7a1907d..a79976d 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -4,8 +4,9 @@ Interface summary:
import copy
- x = copy.copy(y) # make a shallow copy of y
- x = copy.deepcopy(y) # make a deep copy of y
+ x = copy.copy(y) # make a shallow copy of y
+ x = copy.deepcopy(y) # make a deep copy of y
+ x = copy.replace(y, a=1, b=2) # new object with fields replaced, as defined by `__replace__`
For module specific errors, copy.Error is raised.
@@ -56,7 +57,7 @@ class Error(Exception):
pass
error = Error # backward compatibility
-__all__ = ["Error", "copy", "deepcopy"]
+__all__ = ["Error", "copy", "deepcopy", "replace"]
def copy(x):
"""Shallow copy operation on arbitrary Python objects.