title: How can I get optparse's OptionParser to ignore invalid options?
body: <p>In python's <a href="http://docs.python.org/library/optparse.html#optparse.OptionParser" rel="nofollow noreferrer"><code>OptionParser</code></a>, how can I instruct it to ignore undefined options supplied to method <code>parse_args</code>?</p>
  <p>e.g.<BR>
  I've only defined option <code>--foo</code> for my <code>OptionParser</code> instance, but I call <code>parse_args</code> with list: <code>[ '--foo', '--bar' ] </code></p>
  <p>I don't care if it filters them out of the original list.  I just want undefined options ignored.</p>
  <p>The reason I'm doing this is because I'm using SCons' <code>AddOption</code> interface to add custom build options.  However, some of those options guide the declaration of the targets.  Thus I need to parse them out of <code>sys.argv</code> at different points in the script without having access to all the options.  In the end, the top level Scons <code>OptionParser</code> will catch all the undefined options in the command line.</p>