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 Martin.d'Anjou, benschmaus, bethard, docs@python, eric.araujo, eric.smith, martin.panter, mburger, paul.j3, r.david.murray, rhettinger, terry.reedy, tshepang
Date 2014-02-13.08:34:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1392280478.24.0.220493298591.issue9694@psf.upfronthosting.co.za>
In-reply-to
Content
The attached file shows how the default argument groups could be redefined, using 'required' as the criteria.

I've implemented it as a method that is added to a subclass of ArgumentParser.  This method is invoked after arguments are defined, prior to generating the help.

The help looks something like this:

    usage: alt_grouping.py [-h] [-f FOO] -g GOO pos [baz]

    required:
      pos                required positional
      -g GOO, --goo GOO  required optional

    optional:
      -h, --help         show this help message and exit
      -f FOO, --foo FOO  optional
      baz                optional positional

I was thinking of implementing this as a formatter subclass, but given the way the help is assembled, invoking this method from the parser is simpler.
History
Date User Action Args
2014-02-13 08:34:38paul.j3setrecipients: + paul.j3, rhettinger, terry.reedy, bethard, eric.smith, eric.araujo, r.david.murray, docs@python, benschmaus, tshepang, martin.panter, mburger, Martin.d'Anjou
2014-02-13 08:34:38paul.j3setmessageid: <1392280478.24.0.220493298591.issue9694@psf.upfronthosting.co.za>
2014-02-13 08:34:38paul.j3linkissue9694 messages
2014-02-13 08:34:37paul.j3create