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-June/054387.html below:

[Python-Dev] Explicitly declaring expected exceptions for a block

[Python-Dev] Explicitly declaring expected exceptions for a block [Python-Dev] Explicitly declaring expected exceptions for a blockDmitry Dvoinikov dmitry at targeted.org
Tue Jun 21 07:25:18 CEST 2005
Excuse me if I couldn't find that in the existing PEPs, but
wouldn't that be useful to have a construct that explicitly
tells that we know an exception of specific type could happen
within a block, like:

----------------------------------

ignore TypeError:
    do stuff
[else:
    do other stuff]

being essintially identical to

try:
    do stuff
except TypeError:
    pass
[else:
    do other stuff]
    
----------------------------------

The reason for that being self-tests with lots and lots of
little code snippets like this:

try:
    c().foo()
except TypeError:
    pass

which could be written as

ignore TypeError: c().foo()

Sincerely,
Dmitry Dvoinikov
http://www.targeted.org/

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