Re: Long help lines and wrapping
Greg Ward <[email protected]> Mon, 11 Nov 2002 15:35:28 -0500
| Newsgroups | gmane.comp.python.optik.user |
|---|---|
| Message-ID | <[email protected]> |
On 10 November 2002, Bob van der Poel said:
> Opps, no snidness intended. I quite like optik and think it is a
> valuable addition to the python suite. Sorry if my feeble attempt
> at lightness/humour was misinterpreted.
Well, *I* wasn't offended, but I'm also prone to software
anthropomorphy.
> Replace the wrap_text() function called in format_option() with a
> routine specific to optik. This would follow the rules in the existing
> wrap_text() with the following addition: if a \n is found in the text to
> be wrapped, the text will be wrapped at this point. In addition, any
> white space following the \n will be preserved.
>
> If this was to work I could then set up my option like:
>
> parser.add_option("-p", "--pattern", type="string",
> action="store", dest="pattern",
> help="Set Pattern. Available patterns are:\n" +
> " xx use the xx pattern\n" +
> " yy use the yy pattern")
This sounds eminently sensible to me. Easy to implement too. I think
David's idea is massive flaming overkill.
> Just thinking a bit about this myself, I see a pro and a con.
>
> Con: If existing code with '\n's already in the help strings used the
> new routine, it might break. However, I don't see this being a big
> issue? I may be wrong...
That doesn't bother me.
> Pro: Setting up help strings in this manner, esp. with """ strings,
> seems to be quite intutitive.
Yep.
> Question: If I were to impliment this by adding a new wrap_text() is
> there a way this could be done without hacking into the optik code?
No. Furthermore, I need to change Optik to use the new textwrap module
that will be in the Python 2.3 standard library. It's not *that*
different from the wrap_text() function from distutils (I wrote 'em
both), but any change you make *might* be made obsolete when I do that.
IOW: patches welcome, but any patch you supply is more likely to kick me
into working on Optik again than to be checked in. That might not be a
bad thing. ;-)
Greg
--
Greg Ward <[email protected]> http://www.gerg.ca/
MTV -- get off the air!
-- Dead Kennedys
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf