STD_HELP_OPTION and STD_VERSION_OPTION

Greg Ward <[email protected]> Sun, 11 May 2003 22:08:17 -0400
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
Is anyone taking advantage of the fact that STD_HELP_OPTION and
STD_VERSION_OPTION are exported by Optik, and that you can override them
by assigning to optik.option_parser.STD_{HELP,VERSION}_OPTION.

That's not a documented feature, so I hope not.  You see, back in
December, Erik Heneryd said this on python-dev:

> also, even if you tell OptionParser to use your user defined Option class
> (as explained in the docs: op = OptionParser(option_class=MyOption)), it
> still adds standard Option instances to handle autohelp/version.

This is easy to fix if I remove the STD_{HELP,VERSION}_OPTION and
instead use a method of OptionParser to create those two Option objects
and add them to the option list.  (I dimly recall that David Goodger
encouraged something like this a long time ago, but I guess I didn't see
the point then.  I do now!)

This seems like a good change, but it could break backwards
compatibility for people doing perverse/funky things.  If you currently
have code depending on STD_{HELP,VERSION}_OPTION, 1) you have been
warned, and 2) let me know, so I have a clue how many people will be
hurt by this change.

Thanks!

        Greg
-- 
Greg Ward <[email protected]>                         http://www.gerg.ca/
Beware of altruism.  It is based on self-deception, the root of all evil.


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com