bpo-37163: Make the obj argument of dataclasses.replace() a positional-only. (GH-14390)
This commit is contained in:
parent
69150669f2
commit
2d88e63bfc
|
@ -356,7 +356,7 @@ Module-level decorators, classes, and functions
|
|||
def add_one(self):
|
||||
return self.x + 1
|
||||
|
||||
.. function:: replace(instance, **changes)
|
||||
.. function:: replace(instance, /, **changes)
|
||||
|
||||
Creates a new object of the same type of ``instance``, replacing
|
||||
fields with values from ``changes``. If ``instance`` is not a Data
|
||||
|
|
|
@ -1206,7 +1206,7 @@ def make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True,
|
|||
unsafe_hash=unsafe_hash, frozen=frozen)
|
||||
|
||||
|
||||
def replace(obj, **changes):
|
||||
def replace(obj, /, **changes):
|
||||
"""Return a new object replacing specified fields with new values.
|
||||
|
||||
This is especially useful for frozen classes. Example usage:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
The *obj* argument of :func:`dataclasses.replace` is positional-only now.
|
Loading…
Reference in New Issue