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 paul.j3
Recipients Arfrever, barry, paul.j3, r.david.murray, ustinov
Date 2013-11-20.17:14:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1384967641.31.0.601342461049.issue19462@psf.upfronthosting.co.za>
In-reply-to
Content
f.nargs = '?'
    f.default = argparse.SUPPRESS
    f.help = argparse.SUPPRESS

may be best set of tweaks to a positional Action `f`.  In quick tests it removes `f` from the help, suppresses any complaints about a missing string, and does not put anything in the namespace.

But if there is a string in the input that could match this positional, it will be use.

    f.nargs = 0

is another option.  This puts a `[]` (empty list) in the namespace, since 'nothing' matches `f`.  If there is an input string that might have matched it before, you will not get an 'unrecognized argument' error.  `parse_known_args` can be used to get around that issue.

I should stress, though, that fiddling with `nargs` like this is not part of the API.  Tweak this at your own risk.
History
Date User Action Args
2013-11-20 17:14:01paul.j3setrecipients: + paul.j3, barry, Arfrever, r.david.murray, ustinov
2013-11-20 17:14:01paul.j3setmessageid: <1384967641.31.0.601342461049.issue19462@psf.upfronthosting.co.za>
2013-11-20 17:14:01paul.j3linkissue19462 messages
2013-11-20 17:14:01paul.j3create