Fredrik Lundh wrote:
> 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>
(This is Matthew, different google goups account)
aha! Thanks Fredrik. This recursion business always twiddles with my
head ;)
It still took a good stare at the code before I worked it out, then the
little lightbulb moment;
else:
return GetTreeBranch(path[1:],item[path[0]])