[Python-3000] self-contained exceptions

Jim Jewett jimjjewett at gmail.com
Wed Jan 10 18:56:34 CET 2007


On 1/10/07, Collin Winter <collinw at gmail.com> wrote:
> Phillip came up the translation, I just implemented it. ...

>     re = get_resource()
...
>     except RareException as re:
...
>     re.use_resource()

> So 're = None; del re;' is *only* executed if the except body is executed.

So re.use_resource() will usually work (as it does today).

The difference is that when it doesn't work, you'll see something
about NoneType instead the exception type.

(1)  So the warning might be useful even now.

(2)  It may become more important after the patch, since "Where did I
get an Exception?" is easier to figure out than "How did I get a
None?"

-jJ


More information about the Python-3000 mailing list