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


Groups > comp.lang.python > #95335

Re: Hooking Mechanism when Entering and Leaving a Try Block

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <srkunze@mail.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.039
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'ast': 0.09; 'python': 0.10; 'stack': 0.13; 'importing': 0.15; 'subject:when': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'try:': 0.18; 'solution.': 0.18; 'insert': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'sort': 0.25; 'header:User-Agent:1': 0.26; 'chris': 0.26; 'correct': 0.28; 'function': 0.28; 'idea': 0.28; 'possibly': 0.32; 'received:10.0': 0.34; 'something': 0.35; 'step': 0.36; 'should': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'sure': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'some': 0.40; 'back': 0.62; 'charset:windows-1252': 0.62; 'due': 0.65; 'sounds': 0.76; 'topic,': 0.79
Date Thu, 13 Aug 2015 08:28:01 +0200
From "Sven R. Kunze" <srkunze@mail.de>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Hooking Mechanism when Entering and Leaving a Try Block
References <55CA6D7F.1060705@mail.de> <CALwzidkBoDo1TZj2CWfimYtagtArN9r9dvw1Ke9HqcthdipV4Q@mail.gmail.com> <55CB6EAC.5040004@mail.de> <CAPTjJmoqg9sA-QB3RoRPQFx1osOYyBzff-UX8f2zrzxWpt7sYQ@mail.gmail.com> <55CB9425.5050109@mail.de>
In-Reply-To <55CB9425.5050109@mail.de>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-purgate clean
X-purgate This mail is considered clean (visit http://www.eleven.de for further information)
X-purgate-type clean
X-purgate-Ad Categorized by eleven eXpurgate (R) http://www.eleven.de
X-purgate This mail is considered clean (visit http://www.eleven.de for further information)
X-purgate clean
X-purgate-size 732
X-purgate-ID 154282::1439447283-000007B2-7B043067/0/0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.159.1439447284.3627.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1439447284 news.xs4all.nl 2902 [2001:888:2000:d::a6]:46148
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3653
X-Received-Body-CRC 31027476
Xref csiph.com comp.lang.python:95335

Show key headers only | View raw


On 12.08.2015 20:44, Sven R. Kunze wrote:
> On 12.08.2015 18:11, Chris Angelico wrote:
>> 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.
>
> Sounds like I MacroPy would enable me to basically insert a function 
> call before and after each try: block at import time. Is that correct 
> so far? That sounds not so bad at all.
>
>
> However, if that only works due to importing it is not a solution. I 
> need to make sure I catch all try: blocks, the current stack is in 
> (and is about to step into).
>
> Ah yes, and it should work with Python 3 as well. 

Back to topic, please. :)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web