typed_python icon indicating copy to clipboard operation
typed_python copied to clipboard

Common fields for Alternatives

Open atzannes opened this issue 5 years ago • 0 comments

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__.

atzannes avatar Apr 03 '19 14:04 atzannes