Phillip M. Feldman <phillip.m.feld...@gmail.com> added the comment:

That works.  Thanks!

I think that this boils down to a documentation issue.  The following says
that the default behavior is to line-wrap the help messages.  At least to
me, this doesn't imply that whitespace is getting eaten.

RawDescriptionHelpFormatter
<https://docs.python.org/3/library/argparse.html#argparse.RawDescriptionHelpFormatter>
and RawTextHelpFormatter
<https://docs.python.org/3/library/argparse.html#argparse.RawTextHelpFormatter>
give more control over how textual descriptions are displayed. By default,
ArgumentParser
<https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser>
objects line-wrap the description
<https://docs.python.org/3/library/argparse.html#description> and epilog
<https://docs.python.org/3/library/argparse.html#epilog> texts in
command-line help messages:

On Tue, Jul 31, 2018 at 12:43 PM, Zsolt Cserna <rep...@bugs.python.org>
wrote:

>
> Zsolt Cserna <cserna.zs...@gmail.com> added the comment:
>
> You would need to use the RawTextHelpFormatter as format_class for the
> constructor. In this case, argparse will apply no re-wrapping of the
> description.
>
> import argparse
>
> parser = argparse.ArgumentParser(description="""foo
> bar
> baz""", formatter_class=argparse.RawTextHelpFormatter)
>
> ----------
> nosy: +csernazs
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue34299>
> _______________________________________
>

----------

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

Reply via email to