feature request #1055954: respect newlines in description
Tomi Mickelsson <[email protected]> Wed, 9 Mar 2005 10:17:34 +0200 (EET)
| Newsgroups | gmane.comp.python.optik.user |
|---|---|
| Message-ID | <[email protected]> |
Greg wishes discussion about my feature request. You can see my request as item #1055954. In short, I would like to control the linefeeds in the description field. I do not like the way everything in the description is jammed into a single paragraph. For example, here's the usage output of a recent sample app of mine. --- F:\python>beepclient.py usage: beepclient.py server:port testcase beepclient.py is a prototype beep client written in python. The client provides multiple test cases: 1 - send corrupted packet 2 - send packet without CRLF 3 - send ok packet 4 - no CRLF after END 5 - send 2 ok packets 6 - send 2 packets, garbage between 7 - send 2 auth packets, 1 data Author: Tomi Mickelsson. Version 0.1, Feb 2, 2005 options: --version show program's version number and exit -h, --help show this help message and exit -v verbose -fFILENAME filename to merge -pPORT Listen port --- To achieve this formatting, I have the following kludge in my code: --- import new ....code omitted # use my own description formatter method parser.format_description = new.instancemethod(lambda self,x : self.description, parser, parser.__class__) ...now use the parser --- In the solution I replace a method in the parser with my own method that just returns the description as it is without any formatting. While this works ok for my purposes, it's kludgery and looks bad. I'd like to get rid of the new.instancemethod; it scares the developers looking at the code and leaves a bad impression of python. With this solution, I do loose all formatting features of textwrap. Could we draft a solution where textwrap is used but the user can insert hard line breaks in the description text? Tomi Mickelsson, [email protected] ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click