Re: Decorator Dissection

2005-04-03 Thread Ron_Adam
On Sun, 03 Apr 2005 08:32:09 +0200, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >Ron_Adam wrote: >> I wasn't aware that the form: >> >> result = function(args)(args) >> >> Was a legal python statement. >> >> So python has a built in mechanism for passing multiple argument sets >> to neste

Re: Decorator Dissection

2005-04-02 Thread "Martin v. Löwis"
Ron_Adam wrote: I wasn't aware that the form: result = function(args)(args) Was a legal python statement. So python has a built in mechanism for passing multiple argument sets to nested defined functions! (click) Which means this is a decorator without the decorator syntax. No. There is no

Re: Decorator Dissection

2005-04-02 Thread Bengt Richter
On Sat, 02 Apr 2005 21:04:57 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> I followed that part. The part that I'm having problems with is the >> first nested function get's the argument for the function name without >> a previous reference to the argument name in the outer frames. So,

Re: Decorator Dissection

2005-04-02 Thread Ron_Adam
On Sat, 02 Apr 2005 18:39:41 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote: >>def foo(): >>a = 10 >>def bar(): >> return a*a >>return bar >> >>print foo()() <--- *Here* >> >> >>No decorator-specific magic here - just references kept to outer frames >>which form the scope

Re: Decorator Dissection

2005-04-02 Thread Ron_Adam
On Sat, 02 Apr 2005 21:04:57 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> I followed that part. The part that I'm having problems with is the >> first nested function get's the argument for the function name without >> a previous reference to the argument name in the outer frames. So,

Re: Decorator Dissection

2005-04-02 Thread El Pitonero
Ron_Adam wrote: > On 2 Apr 2005 08:39:35 -0800, "Kay Schluehr" <[EMAIL PROTECTED]> > wrote: > > >There is actually nothing mysterious about decorators. > > I've heard this quite a few times now, but *is* quite mysterious if > you are not already familiar with how they work. Or instead of > mysteri

Re: Decorator Dissection

2005-04-02 Thread Ron_Adam
On 2 Apr 2005 08:39:35 -0800, "Kay Schluehr" <[EMAIL PROTECTED]> wrote: > >There is actually nothing mysterious about decorators. I've heard this quite a few times now, but *is* quite mysterious if you are not already familiar with how they work. Or instead of mysterious, you could say complex,

Re: Decorator Dissection

2005-04-02 Thread Diez B. Roggisch
> I followed that part. The part that I'm having problems with is the > first nested function get's the argument for the function name without > a previous reference to the argument name in the outer frames. So, a > function call to it is being made with the function name as the > argument, and th

Re: Decorator Dissection

2005-04-02 Thread Ron_Adam
or the interpreter executing the @decorator statement?), calls nested functions in the function of the same name until it reaches the inner loop which is then attached to the function name. Is this correct now? Cheers, Ron ### Decorator Dissection V.2 ### print "\n(0) Start reading decorato