Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18794
| Date | 2012-01-10 19:26 -0600 |
|---|---|
| From | Evan Driscoll <edriscoll@wisc.edu> |
| Subject | Introspecting optparse/argparse objects |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4620.1326245218.27778.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
I'd like to be able to be able to define options and then look at the
lists. (For a concrete idea of a use case, suppose that it did not
directly support the --help option and I wanted to write code that took
its place.) Unfortunately, there doesn't seem to be any public API for
doing this.
Even if I were to do something like
options = [ make_option(...), make_option(...) ]
(using optparse) and could thus get a handle on the Option objects,
there doesn't seem to be a public API for retrieving stuff like the
actual options (though available via opt._short_opts and opt._long_opts).
This means that either I need to write my own wrappers around options,
option groups, and perhaps even an option parser, or I have to dig into
_variables _that _are _not _part _of _the _public _api. Both of those
choices are distasteful.
So,
1) Did I miss anything?
2) Is there some particular reason that this API *isn't* provided, and
if I asked for it I might get it in a future version?
Evan
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Introspecting optparse/argparse objects Evan Driscoll <edriscoll@wisc.edu> - 2012-01-10 19:26 -0600
Re: Introspecting optparse/argparse objects alex23 <wuwei23@gmail.com> - 2012-01-11 17:37 -0800
Re: Introspecting optparse/argparse objects Evan Driscoll <edriscoll@wisc.edu> - 2012-01-11 20:44 -0600
csiph-web