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


Groups > comp.lang.python > #95360

[Back off topic] - Re: Hooking Mechanism when Entering and Leaving a Try Block

Path csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'ast': 0.09; 'thread': 0.10; 'python': 0.10; 'stack': 0.13; 'importing': 0.15; 'subject: \n ': 0.15; 'entirely.': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'subject:when': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'nested': 0.18; 'tree': 0.18; 'try:': 0.18; 'solution.': 0.18; '>>>': 0.20; 'assuming': 0.22; 'am,': 0.23; 'insert': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'discussion': 0.24; 'sort': 0.25; 'header :User-Agent:1': 0.26; 'chris': 0.26; 'correct': 0.28; 'function': 0.28; 'idea': 0.28; 'branch': 0.30; 'possibly': 0.32; 'message- id:@gmail.com': 0.34; 'structure': 0.34; 'done': 0.35; 'acceptable': 0.35; 'something': 0.35; 'step': 0.36; 'but': 0.36; 'should': 0.36; 'instead': 0.36; '(and': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'being': 0.37; 'client': 0.37; 'received:org': 0.37; 'subject:[': 0.39; 'sure': 0.39; 'easily': 0.39; 'received:192': 0.39; 'rather': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'mark': 0.40; 'some': 0.40; 'your': 0.60; 'back': 0.62; 'here.': 0.62; 'charset:windows-1252': 0.62; 'course': 0.62; 'lose': 0.63; 'strange': 0.63; 'due': 0.65; 'subject:off': 0.66; 'subject': 0.70; 'sounds': 0.76; 'topic,': 0.79; 'merry': 0.84; 'subject:Back': 0.84
X-Virus-Scanned amavisd-new at torriefamily.org
Date Thu, 13 Aug 2015 18:57:58 -0600
From Michael Torrie <torriem@gmail.com>
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 [Back off topic] - 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> <55CC38F1.8070307@mail.de>
In-Reply-To <55CC38F1.8070307@mail.de>
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
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.180.1439513882.3627.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1439513882 news.xs4all.nl 2928 [2001:888:2000:d::a6]:33880
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95360

Show key headers only | View raw


On 08/13/2015 12:28 AM, Sven R. Kunze wrote:
> 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. :)

But we love being off topic!

Also if you change the subject line to demarcate a branch in the
discussion (and mark it as off topic), that is completely acceptable as
well.  This in fact was done eventually by Marko.  That leaves the
original part of the thread to carry on its merry way.  Of course I am
assuming you read your email using a threaded email client that shows
you the nested tree structure of the replies, instead of the really
strange 1-dimensional gmail-style conversations that lose that structure
entirely.

But I digress.  We get sidetracked rather easily around here.

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


Thread

[Back off topic] - Re: Hooking Mechanism when Entering and Leaving a Try Block Michael Torrie <torriem@gmail.com> - 2015-08-13 18:57 -0600

csiph-web