<jsoares <at> Safe-mail.net> writes: > If this is too general a question, perhaps you can tell me when NOT to use recursion(where it would be > inappropriate or inefficient).
Easy way to kill a Python program: >>> def a(): ... a() Recursion is dangerous if its depth is unchecked. I've recently seen a recursive quicksort implementation run wild for example, killing the program without any error message (not in Python, but the principle is the same regardless the programming language). You can use recursion it for a shortest route algorithm, given a group of points with certain connections between them (if there aren't too many points, otherwise you'll hit a recursion depth limit or a stack overflow). Or for a menu navigation system, where a showmenu() routine calls itself to display submenus. Yours, Andrei _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor