New submission from Michael Hoffman:

Adding these four lines to optparse.OptionGroup makes using option
groups vastly easier:

    def __enter__(self):
        return self

    def __exit__(self, *exc_info):
        self.parser.add_option_group(self)

You can then do things like:

    with OptionGroup(parser, "Group name") as group:
        group.add_option(...)

----------
components: Library (Lib)
messages: 62625
nosy: hoffman
severity: normal
status: open
title: optparse.OptionGroup with_statement context handling
type: feature request

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2155>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to