Re: Shortcutting the function call stack

2008-03-25 Thread Francesco Bochicchio
Il Mon, 24 Mar 2008 15:05:38 -0700, Julien ha scritto: ... > > I'll try to explain a bit more what I'm after, and hopefully that will > be clearer. In fact, what I'm trying to do is to "hijack" (I'm making up > the term) a function: > > def hijacker(arg): > if I_feel_its_necessary: >

Re: Shortcutting the function call stack

2008-03-24 Thread Arnaud Delobelle
On Mar 24, 10:05 pm, Julien <[EMAIL PROTECTED]> wrote: > Hi all, and thanks a lot for your answers! > > I'll try to explain a bit more what I'm after, and hopefully that will > be clearer. In fact, what I'm trying to do is to "hijack" (I'm making > up the term) a function: > > def hijacker(arg): >

Re: Shortcutting the function call stack

2008-03-24 Thread John Machin
On Mar 25, 9:05 am, Julien <[EMAIL PROTECTED]> wrote: > Hi all, and thanks a lot for your answers! > > I'll try to explain a bit more what I'm after, and hopefully that will > be clearer. In fact, what I'm trying to do is to "hijack" (I'm making > up the term) a function: > > def hijacker(arg): >

Re: Shortcutting the function call stack

2008-03-24 Thread Julien
Hi all, and thanks a lot for your answers! I'll try to explain a bit more what I'm after, and hopefully that will be clearer. In fact, what I'm trying to do is to "hijack" (I'm making up the term) a function: def hijacker(arg): if I_feel_its_necessary: hijack_caller_function_and_make_

Re: Shortcutting the function call stack

2008-03-24 Thread castironpi
On Mar 24, 9:48 am, Jason <[EMAIL PROTECTED]> wrote: > On Mar 24, 5:21 am, Julien <[EMAIL PROTECTED]> wrote: > > > > > > > Hello all, > > > I would like to do something like: > > > def called(arg) > >     if arg==True: > >         !!magic!!caller.return 1 > > > def caller(arg) > >     called(arg) >

Re: Shortcutting the function call stack

2008-03-24 Thread Jason
On Mar 24, 5:21 am, Julien <[EMAIL PROTECTED]> wrote: > Hello all, > > I would like to do something like: > > def called(arg) > if arg==True: > !!magic!!caller.return 1 > > def caller(arg) > called(arg) > return 2 > > Here, the fake !!!magic!!! represents a statement (which I ig

Re: Shortcutting the function call stack

2008-03-24 Thread Steven D'Aprano
On Mon, 24 Mar 2008 04:21:29 -0700, Julien wrote: > Hello all, > > I would like to do something like: > > def called(arg) > if arg==True: > !!magic!!caller.return 1 Instead of writing "if arg==True", or "if (arg==True)==True", or even "if ((arg==True)==True)==True", you should just