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/2013-October/129609.html below:

[Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

[Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore(). [Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().Zero Piraeus z at etiol.net
Tue Oct 15 20:02:15 CEST 2013
:

On Tue, Oct 15, 2013 at 09:45:59AM -0700, Ethan Furman wrote:
> [...] if the CM provides the value before, and the with block accepts
> it, it can then have the exception added to it:
> 
>     with trap(OSError) as cm:
>         os.unlink('missing.txt')
>     if cm.exc:
>         do_something()

Is there some advantage to this over

    try:
        os.unlink('missing.txt')
    except OSError as exc:
        do_something()

I thought the whole point was to replace code that would otherwise
contain 'except: pass' with something slightly more concise. Once you
expose the exception, it becomes just an uglier version of a try/except
block, as far as I can see.

 -[]z.

-- 
Zero Piraeus: pons asinorum
http://etiol.net/pubkey.asc
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