osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

newb question about @property


Chris Angelico wrote:
> Decorators are fairly straight-forward if you understand higher-order
> functions.  <snip>
>
> ChrisA


I was just minding my own business, and thought to write my first 
decorator for a simple *recursive* function f.  The decorator WORKS if f 
does not make a call to itself.    Otherwise, f seems to have 
"difficulty" calling itself (I get a typerror, f(n) has value 
"NoneType").   What is the explanation for this?  Does f have a new name 
because it has a decorator on it now?

Note: I am not using functools.wraps since I don't yet understand the 
reason I might do that yet (first things first... ).

Thanks!

Bill