Skip to content

Glossary: Software Design Patterns

Copying templates (copy.deepcopy, dataclasses.replace)

Also written: copy.deepcopy, deepcopy, dataclasses.replace, replace

`copy.deepcopy` makes a full independent copy of a dict or list. `replace(weekly, qty=20)` returns a new frozen dataclass with some fields changed and leaves the original alone.

Where the book teaches it

Related terms

Prototype@dataclassFrozen dataclass