pylatexenc icon indicating copy to clipboard operation
pylatexenc copied to clipboard

suggestion for simpler/more correct MacroArgs

Open nschloe opened this issue 3 years ago • 0 comments

Right now, macro args are represented as

ParsedMacroArgs(
    argspec="{",
    argnlist=[...],
)

where len(argspec) == len(argnlist). My suggestion would be to slightly alter this structure to

[
    MacroArg(
        argspec="[",
        arg=#...
    ),
    MacroArg(
        argspec="{",
        arg=#...
    ),
]

This has the advantage that illegal state are irrepresentable (len(argspec) == len(argnlist) is implicit).

nschloe avatar Feb 15 '22 19:02 nschloe