Return returns nothing in recursive function

Fredrik Lundh fredrik at pythonware.com
Tue Oct 17 12:04:49 EDT 2006


Matthew Warren wrote:

> I have the following code that implements a simple recursive tree like
> structure.
> 
> The trouble is with the GetTreeBranch function, the print statement
> prints a valid value but the return immediatley afterward doesn't return
> anything.

hint: how many "return" statements do you see in this piece of code:

            else:
                 GetTreeBranch(path[1:],item[path[0]])

</F>




More information about the Python-list mailing list