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

[Python-Dev] Pre-PEP: Unifying try-except and try-finally

[Python-Dev] Pre-PEP: Unifying try-except and try-finally [Python-Dev] Pre-PEP: Unifying try-except and try-finallyFredrik Lundh fredrik at pythonware.com
Fri May 6 18:32:30 CEST 2005
François Pinard wrote:

> It happens once in a while that I want to comment out the except clauses
> of a try statement, when I want the traceback of the inner raising, for
> debugging purposes.  Syntax forces me to also comment the `try:' line,
> and indent out the lines following the `try:' line.  And of course, the
> converse operation once debugging is done.  This is slightly heavy.

the standard pydiom for this is to change

    try:
        blabla
    except IOError:
        blabla

to

    try:
        blabla
    except "debug": # IOError:
        blabla

(to save typing, you can use an empty string or even
put quotes around the exception name, but that may
make it harder to spot the change)

</F>



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