The InitVar annotation defines a value that is passed as an argument to __init__() and then to __post_init__() but does not exist as a field on the dataclass instance. This is roughly the opposite of init=False, where the field does exist but there is no matching argument of __init__().
As there is an __init__() argument, we could actually bind values to it. But the Binder specialization needs to be extended to support it.
The
InitVar
annotation defines a value that is passed as an argument to__init__()
and then to__post_init__()
but does not exist as a field on the dataclass instance. This is roughly the opposite ofinit=False
, where the field does exist but there is no matching argument of__init__()
.As there is an
__init__()
argument, we could actually bind values to it. But theBinder
specialization needs to be extended to support it.