Hooking Mechanism when Entering and Leaving a Try Block

Ian Kelly ian.g.kelly at gmail.com
Wed Aug 12 17:32:36 CEST 2015

On Tue, Aug 11, 2015 at 3:47 PM, Sven R. Kunze <srkunze at mail.de> wrote:
> is there something like a hook that a Python module could register to in
> order to 'trace' the entering and leaving of arbitrary try blocks?

Not that I'm aware of.

However, it sounds like context managers might do what you want. You
would just need to instrument your try blocks by adding with blocks.

More information about the Python-list mailing list