typed-argument-parser icon indicating copy to clipboard operation
typed-argument-parser copied to clipboard

Feature request: allow double parsing

Open jakkes opened this issue 3 years ago • 1 comments

I've got a use-case where I need to parse args repeatedly. For now, I am simply doing

parser._parsed = False

But an official flag in __init__ would be appreciated.

jakkes avatar Jan 31 '22 12:01 jakkes

Hi @jakkes,

Consistent with the behavior of argparse, we don't allow repeated parsing. In our case, we don't expect parsing to be idempotent (for example, you might increment a variable in process_args and be surprised to see it get incremented twice). As a result, we think that the ugliness of changing an underscored attribute might be warranted. If you have additional reasoning for why this should be an official flag, we're happy to hear it.

Best, Kyle and Jesse

martinjm97 avatar Mar 28 '22 00:03 martinjm97