This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jzwinck
Recipients jzwinck, paul.j3
Date 2014-05-28.11:34:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1401276845.33.0.375796393396.issue20430@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, I have a practical need for dest=SUPPRESS.  One of the reasons is basically what you said: to implement things analogous to --help.  In those cases you want to be able to invoke a function (e.g. via type=myfunc) but not store anything.  Or you may need to ignore an argument completely for compatibility, but you have logic which expects all the arguments returned by parse_args() to be known and meaningful.  In any case, I wrote this ticket because I ran into a concrete need that argparse didn't readily support (which almost never happens!).

As for what the usage statement should show: it should behave as if dest=SUPPRESS were not present.  If metavar is specified, use that, otherwise use the option name as if dest were not passed in.  And we already have the behavior that help=SUPPRESS will hide it from the usage entirely, so that should still work (i.e. dest=SUPPRESS, help=SUPPRESS should hide the option both from --help and the result of parse_args()).
History
Date User Action Args
2014-05-28 11:34:05jzwincksetrecipients: + jzwinck, paul.j3
2014-05-28 11:34:05jzwincksetmessageid: <1401276845.33.0.375796393396.issue20430@psf.upfronthosting.co.za>
2014-05-28 11:34:05jzwincklinkissue20430 messages
2014-05-28 11:34:02jzwinckcreate