How to handle two-level option processing with optparse

Steve Holden steve at
Thu Jan 26 05:06:27 EST 2006

R. Bernstein wrote:
> Giovanni Bajo suggests:
>>If you call OptionParser.disable_interspersed_args() on your parser,
>>it will stop parsing at the first positional argument, leaving other
>>options unparsed.
> Wow - that was a quick answer! Thanks - it works great!
> I see how I missed this. Neither disable_.. or enable_.. have document
> strings. And neither seem to described in the optparser section (6.21)
> of the Python Library (
> I wonder if something like this might be added to the Python Cookbook.
Well you are just as capable of adding it as anyone else, so knock 
yourself out!

Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC           
PyCon TX 2006        

More information about the Python-list mailing list