A leading position of values of type; an optional one may be
missing (it is then missing from the output too).
Attributes#
| Attribute | Type | Description |
|---|---|---|
type | AST | |
optional | bool = False |
Functions#
__init__#
__init__(type, optional=False) -> None| Parameter | Type | Description |
|---|---|---|
type | AST | |
optional | bool = False |
optional_when_encoded#
optional_when_encoded() -> boolWhether the position may be missing from the encoded input (it is optional, or a decoding default fills it).
Returns bool
def optional_when_encoded(self) -> bool:
"""Whether the position may be missing from the encoded input (it is
optional, or a decoding default fills it)."""
return encoded_optional(self.type, optional=self.optional)