[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines
paul j3
report at bugs.python.org
Thu Jul 17 22:55:43 CEST 2014
paul j3 added the comment:
I suspect fixing this isn't going to be easy.
Extra lines are removed by the top most `formatter` function:
def format_help(self):
help = self._root_section.format_help()
if help:
help = self._long_break_matcher.sub('\n\n', help)
help = help.strip('\n') + '\n'
return help
RawDescriptionHelpFormatter on the other hand just changes one deeply embedded function:
def _fill_text(self, text, width, indent):
return ''.join(indent + line for line in text.splitlines(keepends=True))
That `format_help` function has no way of distinguishing between '\n' that were part of the raw text, and which were added while assembling the various parts.
It could be instructive to try this version of format_help and see just how many \n are being removed:
def format_help(self):
help = self._root_section.format_help()
return help
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17113>
_______________________________________
More information about the Python-bugs-list
mailing list