A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-May/053796.html below:

[Python-Dev] PEP 343 - Abstract Block Redux

[Python-Dev] PEP 343 - Abstract Block Redux [Python-Dev] PEP 343 - Abstract Block ReduxDelaney, Timothy C (Timothy) tdelaney at avaya.com
Mon May 16 07:59:41 CEST 2005
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4