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 zbysz
Recipients GraylinKim, bethard, denilsonsa, eric.araujo, zbysz
Date 2011-09-24.22:34:22
SpamBayes Score 2.7755576e-16
Marked as misclassified No
Message-id <1316903664.31.0.1067416489.issue12806@psf.upfronthosting.co.za>
In-reply-to
Content
This is a great idea! I think that this formatter is much more useful than the default one. I was pretty surprised the first time I added a multi-paragraph epilog to a program and it got all jumbled into a single line. I would vote to make this (or a variant, see the comments below) the default formatter for the description and epilog fields.

Notes on the interface (a bit of bike-shedding :)):

Continuation backslashes are best avoided. Other means, like parenthesis in case of expressions, are encouraged to avoid adding backslashes. Continuation symbols also interfere with paragraph reflowing in text editors.
Using backslash continuations wouldn't be necessary, if the rules were slightly changed to be more LaTeX like: just line-wrap paragraphs, and paragraphs are separated by a blank line. This would make it impossible to have two line-wrapped parts not separated by an empty line, but I think that this is less common and less important than having a "natural" representation of paragraphs.

In current implementation, lines that are not wrapped (IIUC) are those which start with *, +, >, <anything>., or <something>). This seems error prone. Maybe it would be better to just detect lines which are indented at least one space in comparison to the first line. This would work for examples and lists:
"""
this is a text that is subject to line-wrapping
  and this line not
and this line would again be wrapped:
  - and a line, not merged with the one above or below
  - and a second point, not merged with the one above
"""

Review of argparse_formatter.py:
> list_match = re.match(r'( *)(([*-+>]+|\w+\)|\w+\.) +)',line)
 A dash '-' has special meaning in brackets:
  [*-+>] means (characters in range from '*' to '+', or '>').
 Because star and plus are adjacent in ASCII, this is equivalent to
  [*+>]
 but quite unclear.

>  if(list_match):
Parenthesis unnecessary.

> lines = list()
Why not just 'lines = []'?

One a side note: due to #13041 the terminal width is normally stuck
at 80 chars.
History
Date User Action Args
2011-09-24 22:34:24zbyszsetrecipients: + zbysz, bethard, eric.araujo, denilsonsa, GraylinKim
2011-09-24 22:34:24zbyszsetmessageid: <1316903664.31.0.1067416489.issue12806@psf.upfronthosting.co.za>
2011-09-24 22:34:23zbyszlinkissue12806 messages
2011-09-24 22:34:23zbyszcreate