Recusive function inside a function can't find itself.

sekter sekter at mail.matav.hu
Sat Oct 23 04:21:36 EDT 1999


Glyn Webster <glyn at ninz.not.org.nz> wrote in message
news:7ur95o$bk8$1 at news.wave.co.nz...
> I've defined a function inside a function. I pass all
> the variables it needs into it through its argument
> list, which usually works. But what happens this time
> is that I get a "NameError: fill_code_list" where the
> function first calls itself recusively.
>
> Am I doing something wrong?
> (Other than pretending Python is Scheme?)

Well, Python has only three namespaces: local., global, builtin. In this
case the local means the namespace of your recursive function and the global
is your module's namespace, but your recursive func is defined in the
namesapce of the container function. Moving your recursive func to the modul
level should solve this..
Arpad Kiss






More information about the Python-list mailing list