Add support for boolean type slightly redundant with flags but an easy enough add and gives the user a little more flexibility.
Here's the results of a diff run on the original optparse,py and the modified one.
439a440,446
> def check_boolean(option, opt, value):
> if value.lower()=='true': return True
> elif value.lower()=='false': return False
> else:
> raise OptionValueError(
> _("option %s: invalid Boolean value: %r") % (opt, value))
>
521c528
< TYPES = ("string", "int", "long", "float", "complex", "choice")
---
> TYPES = ("string", "int", "long", "float", "complex", "choice", "boolean")
543a551
> "boolean": check_boolean
Sorry -- I'm no longer maintaining optik as a separate package, so this should be filed as a Python feature request (see http://www.python.org/dev/patches/\).
If you do, here are some suggestions:
1) use unified diff (diff -u)
2) respect the style guide (http://www.python.org/dev/peps/pep-0008/)
3) accept a much broader range of values -- e.g. ('true', 't', 'yes', 'y', '1'), and ('false', 'f', 'no', 'n', '0')
4) be consistent with Python terminology and call it 'bool', not 'boolean'
5) update the documentation
6) update the tests
7) explain why this is useful and necessary
Thanks for your submission!