Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95288 > unrolled thread

Re: Hooking Mechanism when Entering and Leaving a Try Block

Started by"Sven R. Kunze" <srkunze@mail.de>
First post2015-08-12 18:05 +0200
Last post2015-08-12 18:05 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Hooking Mechanism when Entering and Leaving a Try Block "Sven R. Kunze" <srkunze@mail.de> - 2015-08-12 18:05 +0200

#95288 — Re: Hooking Mechanism when Entering and Leaving a Try Block

From"Sven R. Kunze" <srkunze@mail.de>
Date2015-08-12 18:05 +0200
SubjectRe: Hooking Mechanism when Entering and Leaving a Try Block
Message-ID<mailman.115.1439395514.3627.python-list@python.org>
Unfortunately, no. :(

It should work out of the box with no "let me replace all my try-except 
statements in my 10 million line code base".

On 12.08.2015 17:32, Ian Kelly wrote:
> On Tue, Aug 11, 2015 at 3:47 PM, Sven R. Kunze <srkunze@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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web