mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
[3.13] gh-121300: Add replace
to copy.__all__
(GH-121302) (#121337)
(cherry picked from commit 7c66906802
)
Co-authored-by: Max Muoto <maxmuoto@gmail.com>
This commit is contained in:
parent
253c033251
commit
8799f0537b
2 changed files with 8 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue