Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13119

Re: optionparse: how to add a line break to the help text

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '(of': 0.05; 'snippet': 0.07; 'versions.': 0.07; 'python': 0.08; ':-(': 0.09; 'deprecated,': 0.09; 'optparse': 0.09; ';-)': 0.12; 'library': 0.15; '"don\'t': 0.16; '-tkc': 0.16; 'argparse': 0.16; 'backported': 0.16; 'finney': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'py2.6': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; '2.x': 0.18; 'cc:no real name:2**0': 0.20; 'subject:help': 0.22; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'structure': 0.23; 'versions': 0.23; 'debian': 0.23; 'posted': 0.26; "i'm": 0.27; "wasn't": 0.28; 'problem': 0.28; 'replaced': 0.29; 'cc:addr:python.org': 0.30; 'earlier': 0.32; 'source': 0.33; 'probably': 0.33; 'header:User- Agent:1': 0.34; 'subject:text': 0.35; 'file': 0.36; 'url:python': 0.36; 'minimal': 0.37; 'run': 0.37; 'but': 0.37; 'think': 0.38; 'patch': 0.38; 'some': 0.38; 'subject:: ': 0.39; 'manually': 0.39; 'help': 0.39; 'more': 0.60; 'wide': 0.63; 'series': 0.65; 'became': 0.67; 'dire': 0.67; 'care': 0.71; 'become': 0.71; 'subject:line': 0.73; 'url:answers': 0.84; 'url:topic': 0.91; 'readily': 0.93
Date Sun, 11 Sep 2011 06:05:56 -0500
From Tim Chase <python.list@tim.thechases.com>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.20) Gecko/20110826 Icedove/3.1.12
MIME-Version 1.0
To Gelonida N <gelonida@gmail.com>
Subject Re: optionparse: how to add a line break to the help text
References <j4gi5r$gjc$1@dough.gmane.org> <mailman.952.1315693006.27778.python-list@python.org> <op.v1mdm0oba8ncjz@gnudebst> <j4h4dh$60n$1@dough.gmane.org> <4E6C182D.60905@tim.thechases.com> <j4h8lh$qui$1@dough.gmane.org>
In-Reply-To <j4h8lh$qui$1@dough.gmane.org>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Source
X-Source-Args
X-Source-Dir
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.977.1315739164.27778.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1315739165 news.xs4all.nl 2400 [2001:888:2000:d::a6]:51854
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:13119

Show key headers only | View raw


On 09/10/11 22:07, Gelonida N wrote:
>> http://bytes.com/topic/python/answers/734066-how-output-newline-carriage-return-optparse
>
> It works (of course ;-) ) like a charm. Good to know, that I'm
> not the only one who want's to structure the help text a
> little nicer.
>
> Considering, that you posted the snippet in 2007 and this is
> very probably a reocurring problem for any slighty more
> complicated help text it is really a pity, that it did not
> become of part of the standard optparse library :-(

Even at the time, the optparse library wasn't readily patchable 
as the inline documentation gave some dire warning about "don't 
edit this directly, as this file is generated from some other 
source"—I never was able to dig up that source to patch against.

As Ben Finney replied, optparse is now deprecated, replaced in 
part by argparse. Unfortunately, argparse wasn't backported to 
the standard library for earlier 2.x series (I think it became 
available in 2.7, and may run in earlier versions if manually 
added like I had to do on my Debian Py2.6 install). But that 
makes it hard for those of us who want to use a built-in 
option-parsing library across a wide variety of Python versions. 
  I don't strongly care which I use except that I want it to be 
broadly available with minimal fuss.

-tkc

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: optionparse: how to add a line break to the help text Rafael Durán Castañeda <rafadurancastaneda@gmail.com> - 2011-09-11 00:16 +0200
  Re: optionparse: how to add a line break to the help text "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2011-09-11 02:12 +0100
    Re: optionparse: how to add a line break to the help text Gelonida N <gelonida@gmail.com> - 2011-09-11 03:54 +0200
    Re: optionparse: how to add a line break to the help text Tim Chase <python.list@tim.thechases.com> - 2011-09-10 21:08 -0500
    Re: optionparse: how to add a line break to the help text Gelonida N <gelonida@gmail.com> - 2011-09-11 05:07 +0200
      Re: optionparse: how to add a line break to the help text Ben Finney <ben+python@benfinney.id.au> - 2011-09-11 15:20 +1000
        Re: optionparse: how to add a line break to the help text Gelonida N <gelonida@gmail.com> - 2011-09-11 16:30 +0200
    Re: optionparse: how to add a line break to the help text Tim Chase <python.list@tim.thechases.com> - 2011-09-11 06:05 -0500
    Re: optionparse: how to add a line break to the help text Robert Kern <robert.kern@gmail.com> - 2011-09-11 15:22 -0500

csiph-web