If you don’t want anybody to adjust the attributes of a class, use @dataclass(frozen=True)
.
In the example above, changing the attribute color of the DataClassDog
‘s instance will throw an error.
If you don’t want anybody to adjust the attributes of a class, use @dataclass(frozen=True)
.
In the example above, changing the attribute color of the DataClassDog
‘s instance will throw an error.
CodeCut is a platform that offers short and visually appealing code snippets related to data science, data analysis, data engineering, and Python programming.
Copyright © 2025 Code Cut - All rights reserved.