[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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_group(group)

Finally, the __exit__ handler adds the option group to the parser in any
case, whether there was an exception raised inside the block or not.

--
nosy: +srittau

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 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]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com