Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(using': 0.05; 'suppose': 0.05; 'version?': 0.07; 'content-type:multipart/signed': 0.09; 'filename:fname piece:signature': 0.09; 'wrappers': 0.09; 'api': 0.09; "*isn't*": 0.16; '--help': 0.16; 'content-type:application /pgp-signature': 0.16; 'filename:fname piece:asc': 0.16; 'filename:fname:signature.asc': 0.16; 'parser,': 0.16; 'retrieving': 0.16; 'stuff': 0.22; "doesn't": 0.22; 'asked': 0.22; 'thus': 0.23; '(though': 0.23; 'objects,': 0.23; 'code': 0.25; 'seem': 0.30; 'actual': 0.32; 'idea': 0.32; 'header:User-Agent:1': 0.33; 'this.': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'something': 0.35; 'subject:/': 0.35; '(for': 0.35; 'received:192': 0.37; 'options': 0.37; 'received:128': 0.37; 'could': 0.37; 'doing': 0.38; 'some': 0.38; 'received:192.168.0': 0.38; 'option': 0.39; "i'd": 0.39; 'either': 0.39; 'define': 0.39; 'to:addr:python.org': 0.40; 'might': 0.40; 'received:192.168': 0.40; 'miss': 0.62; 'took': 0.63 Date: Tue, 10 Jan 2012 19:26:15 -0600 From: Evan Driscoll User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: python-list@python.org Subject: Introspecting optparse/argparse objects X-Enigmail-Version: 1.3.4 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3812C88A8500B9C1FD7BDCD9" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 51 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1326245218 news.xs4all.nl 6884 [2001:888:2000:d::a6]:56835 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18794 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3812C88A8500B9C1FD7BDCD9 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 =3D [ 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 --------------enig3812C88A8500B9C1FD7BDCD9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPDOU9AAoJEAOzoR8eZTzgQ9wH/0cvWkMcq/5qrgJBtPa4qdSJ QKPbVh/8lkWoa9aGRUVYDnKfKHcAnoW5BzwgkDuivs8Z9ULz9jTW75RBOSsN08TD 21YtuJXbgKfUcs7E3an/z6uvE9vxqY/aXtmuUNpnhbjMyyPPvMyEL26NlT/Nh9ap xf68m6aTlk5FgqKEg/4YlJe6suIlIpTQ38LInV6aqXL1cD3T5JmY4srW1wzSGzXm fY/nn3m5j1KdMACm/Sq+BZ/sVwVy5e9+BmIqfvXWaxQuwnSg4QP57vTJz/caskh3 sMcdEZVXOZcUH4p+P7Sy7buOMQbFgaatnPO2kABg9yczIuk7vs/3MzsLX+8ngHs= =v8Qo -----END PGP SIGNATURE----- --------------enig3812C88A8500B9C1FD7BDCD9--