epy.frozen#
- etils.epy.frozen(
- cls: etils.epy.py_utils._Cls,
Class decorator which prevent mutating attributes after __init__.
Example:
@epy.frozen class A: def __init__(self): self.x = 123 a = A() a.x = 456 # AttributeError
Supports inheritance, child classes should explicitly be marked as
@epy.frozenif they mutate additional attributes in __init__.- Parameters:
cls – The class to freeze.
- Returns:
The class object
- Return type:
cls