tjreedy at udel.edu
Fri Feb 12 06:31:14 CET 2010
On 2/11/2010 6:36 PM, Gabriel Genellina wrote:
> This is simple to implement, but requires changing the function
> definition. My goal was to keep the original code unchanged, that is,
> leave it as:
> def f(n):
> if n > 0: return n*f(n-1)
> elif n==0: return 1
> (like a normal, recursive function), and make the 'f' inside the function
> body "magically" refer to the function itself.
Someone did this several years ago with a bytecode hack. I believe it
was in the cookbook. It was rejected as part of standard CPython.
More information about the Python-list