ID EN
Dataclasses

replace

Python 3.11

Creates a new object of the same type as obj, replacing fields with values from changes. If obj is not a Data Class, raises TypeError. If values in changes do not specify fields, raises TypeError.

Syntax

PYTHON
dataclasses.replace(obj, /, **changes)

See Also

TypeError TypeError __init__() __post_init__ ValueError