frozen=True: Make Your Data Classes Read-Only

frozen=True: Make Your Data Classes Read-Only

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.

Search

Related Posts

Related Posts

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran