[Tutor] Binary Tree Printing Woes

Alan Gauld alan.gauld@blueyonder.co.uk
Fri Jun 6 18:03:01 2003


> .....But how come the print_tree() function - which ALSO returns 
> None works just dandy?!

Good question and I asked myself the same thing.

I didn't see an obvious answer but assumed it must 
be some strange combination of calling pattern. I suspect 
a bigger tree might give a different answer, a 3 node one 
isn't enough to test all scenarios. A cop out sorry! :-)

> But how do I rewrite the function so make the "print" ignore it? 

Just call the function, since it does its own printing you 
don't need to! Alternatively, and better practice, make the 
function return a list of values and you then print those 
outside the function..

Alan G.