Hooking Mechanism when Entering and Leaving a Try Block

Chris Angelico rosuav at gmail.com
Wed Aug 12 18:11:26 CEST 2015


On Thu, Aug 13, 2015 at 2:05 AM, Sven R. Kunze <srkunze at mail.de> wrote:
> 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".

(Please don't top-post.)

Sounds to me like you want some sort of AST transform, possibly in an
import hook. Check out something like MacroPy for an idea of how
powerful this sort of thing can be.

ChrisA


More information about the Python-list mailing list