Re: Unexpected behaviour of inner functions/ decorators

2009-06-30 Thread Scott David Daniels
Francesco Bochicchio wrote: def dec_f(f): def inner_f(): if f.enabled: f() return inner_f @dec_f def funct(): print "Ciao" The three lines above should behave a lot like: def funct_original(): print "Ciao" funct = dec_f(funct_original) > funct.e

Re: Unexpected behaviour of inner functions/ decorators

2009-06-30 Thread David Stanek
On Tue, Jun 30, 2009 at 1:44 PM, Francesco Bochicchio wrote: > [snip] > It looks like the decorator uses an older  instance of 'funct', which > does not yet > have the attribute dinamically attached to it. This seem to be > confirmed by the fact that adding the attribute before > rebinding the fu