On Nov 8, 11:46 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > I'm trying to implement some simple command line options. > > Some of the 'help' sections are long and I would like to > > control line breaks. How do you do this? > > I had this problem earlier and solved it here: > > http://groups.google.com/group/comp.lang.python/browse_frm/thread/6df... > > thanks to a little guidance from Ben Finney on where to look. > > It came up again last month here: > > http://groups.google.com/group/comp.lang.python/browse_frm/thread/e72... > > which should solve the problem for you. > > ASIDE: I've started refactoring this bit out in my local > source...how would I go about contributing it back to the Python > code-base? I didn't get any feedback from posting to the Optik > site. My refactor basically takes an optional pre-processing > function to parse your string into the output that gets passed to > textwrap.wrap() and textwrap.fill(), defaulting to the old > behavior, but offering a function for splitting it into > paragraphs based on newlines. > > -tkc
Thanks for the help Tim. I just copied and pasted your code into a file in my $PYTHONPATH (IndentedHelpFormatterWithNL.py), but I'm getting the following error: class IndentedHelpFormatterWithNL(IndentedHelpFormatter): NameError: name 'IndentedHelpFormatter' is not defined I tried adding: from optparse imoport IndentedHelpFormatter into the aforementioned file, but no luck again. What am I missing??? Thanks. -- http://mail.python.org/mailman/listinfo/python-list