newb question about @property

Bill BILL_NOSPAM at whoknows.net
Mon Oct 2 23:39:43 EDT 2017


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



More information about the Python-list mailing list