[Zope] Python method: recursive function gives NameError

Willem Broekema willem@imeme.net
Tue, 28 Nov 2000 17:24:20 +0100


I have a simple recursive function in a Python method that gives a
NameError (2.2.4 on Win98).

The function (in PM named 'rec'):
---
def myfunc(i):
  if i >= 10: return myfunc(1)
  else: return 1

return myfunc(11)
---

The end of the traceback:
---
File c:\myzopeinstance\...cts\PythonMethod\PythonMethod.py, line 168, in
__call__
    (Object: rec)
    (Info: ((), {}, None))
File <string>, line 6, in rec
    (Object: myfunc)
File <string>, line 3, in myfunc
NameError: (see above)
---

Isn't it allowed to have a recursive function here?


- Willem