Recursive method
Gordon McMillan
gmcm at hypernet.com
Tue Jul 13 16:41:08 EDT 1999
Ralph Gauges writes:
> ... (see code below). Unfortunately all I get is a
> 'NameError' for makenodes, when the function is supposed to
> call itself.
...
>
> def makeTree():
> .
> .
> def makenodes(C):
>
The problem is the nested definition. The name "makenodes" is local
to makeTree and makeTree's locals are not visible inside makenodes.
Unnest makenodes and it should work.
- Gordon
More information about the Python-list
mailing list