[issue2155] optparse.OptionGroup with_statement context handling

2010-08-01 Thread Georg Brandl
Georg Brandl added the comment: I agree with Sebastian that this is not a good use for a context manager. -- nosy: +georg.brandl resolution: -> rejected status: open -> closed ___ Python tracker __

[issue2155] optparse.OptionGroup with_statement context handling

2008-12-15 Thread Sebastian Rittau
Sebastian Rittau added the comment: This API is too "magical" to my liking and doesn't really reflect what context manager's are supposed to do, i.e. handling resources. Also, I don't see much advantage over: group = OptionGroup(parser, "Group name") group.add_option(...) parser.add_option_grou

[issue2155] optparse.OptionGroup with_statement context handling

2008-12-11 Thread Michael Hoffman
Michael Hoffman added the comment: Is there anything I can do to get this feature request considered earlier? I can generate a real patch, but I figured that wouldn't necessary for something so simple. This has the advantage that it can probably be cut/pasted into any version of the code. _

[issue2155] optparse.OptionGroup with_statement context handling

2008-03-19 Thread Sean Reifschneider
Sean Reifschneider <[EMAIL PROTECTED]> added the comment: Patch is inline. -- assignee: -> gward keywords: +patch nosy: +gward, jafo priority: -> normal __ Tracker <[EMAIL PROTECTED]> __

[issue2155] optparse.OptionGroup with_statement context handling

2008-02-21 Thread Michael Hoffman
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 Option