How do I get optparse list all possible arguments and options?
<p>I'm using Python 2.6.2 (unfortunately can't upgrade to 2.7, or I'd use argparse). How can I get optparse to return a list of the options that have been added via 'add_option'?</p>

<p>Here's some sample code:</p>

<pre><code>from optparse import OptionParser
parser = OptionParser()
parser.add_option('--one')
parser.add_option('--two')
(opts,args) = parser.parser_args()

optlist = parser.funcToGetListOfOptions()
print optlist
['one', 'two']
</code></pre>

<p>I've looked through the optparse source and can figure it out by accessing internal attributes, but that doesn't seem very kosher. What's the right way to do this?</p>

<p>Thanks!</p>
