From: Michele Simionato on
On Aug 1, 1:08 pm, News123 <news1...(a)free.fr> wrote:
> I wondered, whether there's a simple/standard way to let
> the Optionparser just ignore unknown command line switches.
>
> thanks in advance for any ideas

I will plug in my own work on plac: http://pypi.python.org/pypi/plac
Your problem would be solved as follows:

import plac

@plac.annotations(test=('a flag', 'flag', 't'))
def main(test, *ignore):
print test, ignore

if __name__ == '__main__':
plac.call(main, ["-t","--ignoreme_and_dont_fail"])