A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-October/057046.html below:

[Python-Dev] Proposed changes to PEP 343

[Python-Dev] Proposed changes to PEP 343 [Python-Dev] Proposed changes to PEP 343Anders J. Munch ajm at flonidan.dk
Fri Oct 7 15:23:47 CEST 2005
Nick Coghlan did a +1 job to write:
> 1. Amend the statement specification such that:
> 
>        with EXPR as VAR:
>            BLOCK
> 
> is translated as:
> 
>        abc = (EXPR).__with__()
>        exc = (None, None, None)
>        VAR = abc.__enter__()
>        try:
>            try:
>                BLOCK
>            except:
>                exc = sys.exc_info()
>                raise
>        finally:
>            abc.__exit__(*exc)

Note that __with__ and __enter__ could be combined into one with no
loss of functionality:

        abc,VAR = (EXPR).__with__()
        exc = (None, None, None)
        try:
            try:
                BLOCK
           except:
                exc = sys.exc_info()
                raise
        finally:
            abc.__exit__(*exc)
 
- Anders
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