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 lucatrv, paul.j3, rhettinger
Date 2020-03-01.18:09:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583086170.67.0.889353932537.issue39809@roundup.psfhosted.org>
In-reply-to
Content
https://bugs.python.org/issue13041

is (I think) the latest issue/patch to deal with the help width.

I don't like the idea of adding more parameters to the `ArgumentParser` class.  It's too complicated already.

There are a couple of ways that a user can do this already.

One is a custom version of the `parser.format_help`, though as your patch shows, that actually has to go through the `_get_formatter` method.  Only `format_help` is listed in the public API.

Another is a subclass of HelpFormatter.  It just needs to customize the `width` parameter.   

I vaguely recall suggesting such a subclass in a previous bug/issue, but can't find that.

Subclassing HelpFormatter is an established way of customizing the format.

Here's a discussion of this on StackOverflow.  It uses a simple lambda as `formatter_class`:

https://stackoverflow.com/questions/44333577/explain-lambda-argparse-helpformatterprog-width

formatter = lambda prog: argparse.HelpFormatter(prog, width=100)

and 

https://stackoverflow.com/questions/32888815/max-help-position-is-not-works-in-python-argparse-library
History
Date User Action Args
2020-03-01 18:09:30paul.j3setrecipients: + paul.j3, rhettinger, lucatrv
2020-03-01 18:09:30paul.j3setmessageid: <1583086170.67.0.889353932537.issue39809@roundup.psfhosted.org>
2020-03-01 18:09:30paul.j3linkissue39809 messages
2020-03-01 18:09:30paul.j3create