ValueHashedFields.require_parameters_are_fields#
- t3toolbox.backend.common.ValueHashedFields.require_parameters_are_fields()#
def require_parameters_are_fields(self) -> None:
Reject a parameter that was stashed on the instance instead of declared as a field.
The value identity is built from
dc.fields(self), so anything else an instance carries is invisible to it – two objects that differ only in such a value compare EQUAL, and since these objects are jaxaux_dataone of them silently receives the other’s compiled program. That makes “parameters are fields” a correctness rule, not a style preference, and this turns the three ways of breaking it (a hand-written__init__, a bare class attribute assigned per instance, a class that forgot its@dataclassdecorator) into a construction-time error.Call it from
__post_init__. Values cached byfunctools.cached_propertyalso live in__dict__by design and are skipped – they are derived, never parameters.- Return type:
None