typed_python
typed_python copied to clipboard
Common fields for Alternatives
Currently, if all concrete alternatives share a number of fields, these have to be repeated explicitly. It would be better to have a mechanism to declare common alternative fields, for example:
alt = Alternative(
"AltName",
{'common1': typ1, 'common2': typ2},
Alt1={},
Alt2={'alt2_field1': typ_a21},
....
)
In this example, the common fields are passed as a dict, as an optional second positional argument. Alternatively, we could have an them passed as an optional keyword argument __common__
.