my recursive function call is wrong?

Kev Dwyer kevin.p.dwyer at gmail.com
Sun Aug 16 15:31:19 CEST 2009


On Sun, 16 Aug 2009 16:57:41 +0900, Chang Min Jeon wrote:


Hello,

You have placed recursive calls to the function in a number of different 
locations; when len(macro) becomes zero control will return to the 
calling function, but this calling function may have more code to 
execute, including further calls to start_parse(), and further attempts 
to index macro.

I like to keep recursive calls at the end of a function, so that there is 
a clean path back to the top level caller once the terminal condition is 
reached.  You can do it differently, but you need to bear in mind the 
execution paths through your code.

Cheers,

Kev




More information about the Python-list mailing list