Zbyszek Szmek <zbys...@in.waw.pl> added the comment: 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. ---------- nosy: +zbysz _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12806> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com