PEP proposal optparse
Pete Forman
pete.forman at westerngeco.com
Fri Sep 19 07:37:51 EDT 2008
James <jlnicolson at gmail.com> writes:
> 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.
-1
I see no advantage to swelling optparse when the language offers many
solutions already. E.g.
desc = {
'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', help = desc['verbose'])
...
Or another approach might be like this.
for ... in zip(...):
parser.add_option(...)
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pete.forman at westerngeco.com -./\.- the opinion of Schlumberger or
http://petef.22web.net -./\.- WesternGeco.
More information about the Python-list
mailing list