paul j3 added the comment:

An alternative to passing a Formatter instance to the parser is to use a 
wrapper function.  `HelpFormatter.__init__` takes several keyword args. 
'_get_formatter' does not use those.  However we could define:

    def format_wrapper(**kwargs):
        # class 'factory' used to give extra parameters
        def fnc(prog):
            cls = argparse.HelpFormatter
            return cls(prog, **kwargs)
        return fnc

and use that to set the 'width' of the formatter object.

    parser =  argparse.ArgumentParser( formatter_class =  
format_wrapper(width=40))

----------

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

Reply via email to