Re: making a variable available in a function from decorator

2007-07-30 Thread Bruno Desthuilliers
Evan Klitzke a écrit : > On 7/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >>is it possible to do this without passing it as a function argument? >> > Sort of. Functions are objects in python, so you can set attribute on them. > E.g. > > def foo(): > return foo.c > > foo.c = 1 > pr

Re: making a variable available in a function from decorator

2007-07-30 Thread Evan Klitzke
On 7/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > is it possible to do this without passing it as a function argument? > Sort of. Functions are objects in python, so you can set attribute on them. E.g. def foo(): return foo.c foo.c = 1 print foo() Which will print 1. Of course, it

Re: making a variable available in a function from decorator

2007-07-30 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (top-post corrected) > > On 30 Jul 2007 06:17:25 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> > wrote: >> On Sun, 29 Jul 2007 15:22:47 -0700, [EMAIL PROTECTED] wrote: >> >>> I create a variable in a decorator. i want to be able to access that >>> variable in the f

Re: making a variable available in a function from decorator

2007-07-30 Thread [EMAIL PROTECTED]
is it possible to do this without passing it as a function argument? On 30 Jul 2007 06:17:25 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sun, 29 Jul 2007 15:22:47 -0700, [EMAIL PROTECTED] wrote: > > > I create a variable in a decorator. i want to be able to access that > > variab

Re: making a variable available in a function from decorator

2007-07-29 Thread Marc 'BlackJack' Rintsch
On Sun, 29 Jul 2007 15:22:47 -0700, [EMAIL PROTECTED] wrote: > I create a variable in a decorator. i want to be able to access that > variable in the function to be decorated. How to do this? Pass it as argument to the function: def deco(func): eggs = 42 def decorated(*args, **kwargs):

Re: making a variable available in a function from decorator

2007-07-29 Thread Gabriel Genellina
En Sun, 29 Jul 2007 19:22:47 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > I create a variable in a decorator. i want to be able to access that > variable in the function to be decorated. How to do this? Combining `wraps` and `partial` from the functools standard module

making a variable available in a function from decorator

2007-07-29 Thread [EMAIL PROTECTED]
Hi I create a variable in a decorator. i want to be able to access that variable in the function to be decorated. How to do this? thanks -- http://mail.python.org/mailman/listinfo/python-list