paul j3 <ajipa...@gmail.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39809>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to