Steven Bethard wrote:
> If I've misunderstood, and there are other situations when
> "needs_finish" is required, it'd be nice to see some more examples.
The other cases are where you want to do something in response to an
exception, but not otherwise::
def gen():
try:
yield
except:
print 'Got exception:', sys.exc_info()
raise
Personally, I think they're rare enough that you could use a decorator
in those cases, but still have::
def gen():
try:
yield
finally:
pass
automatically make the generator conform to the do/with protocol.
Tim Delaney
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com