PEP proposal optparse



Hi,

I would like to know your thoughts on a proposed change to optparse
that I have planned. It is possible to add default values to multiple
options using the set_defaults. However, when adding descriptions to
options the developer has to specify it in each add_option() call.
This results in unreadable code such as:

parser.add_option('-q', '--quiet' , action="store_false",
dest='verbose',
help = 'Output less information')
parser.add_option('-o', '--output' , type='string',
dest='castordir' , metavar='<DIR>' ,
help = 'specify the wanted CASTOR directory where to store the
results tarball')
parser.add_option('-r', '--prevrel' , type='string',
dest='previousrel' , metavar='<DIR>' ,
help = 'Top level dir of previous release for regression
analysis' )

The same code could become much more readable if there was an
equivalent method of set_defaults for the description/help of the
option. The same code could then become:

parser.set_description(
verbose = 'Output less information',
castordir = 'specify the wanted CASTOR directory where
to store the results tarball',
previousrel = 'Top level dir of previous release for
regression analysis')

parser.add_option('-q', '--quiet' , action="store_false",
dest='verbose')
parser.add_option('-o', '--output' , type='string',
dest='castordir' , metavar='<DIR>' )
parser.add_option('-r', '--prevrel' , type='string',
dest='previousrel' , metavar='<DIR>' )

Help descriptions can often be quite long and separating them in this
fashion would, IMHO, be desirable.

Kind Regards,
James Nicolson

.



Relevant Pages

  • Re: Exmerge error on import Exchange2003
    ... GROUP/MAILBOX STORE '. ... Ignored 3 mailboxhomed on database 'FIRST STORAGE ... All mailboxes will be processed, ... >Please specify another Domain controller in the domain containing the ...
    (microsoft.public.exchange.admin)
  • Re: Non-stationary sales data
    ... the sales of product A in store one. ... Ordinary Regression Models were developed for cross-sectional data. ... Regression Structure, ...
    (sci.stat.consult)
  • Re: Exporting/ importing certificates
    ... the "Import Successful" message. ... If we specified what store to put it in (either physical ... >the cert in any store. ... However if I do not specify a ...
    (microsoft.public.security)
  • Re: Float comparison
    ... the floating point object doesn't specify a range. ... to store a value, but only one value at a time. ... You just attempted to specify the programming. ...
    (comp.lang.c)
  • Re: Error creating a node
    ... Allan Bruce wrote: ... > I have to specify in the argument list, all types I wish to store in my ...
    (comp.lang.cpp)