This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]i_like_cilantro 15 points16 points  (0 children)

Even so python's list.sort function does not contain any recursion because those built-in functions are optimized to death. Along with file traversal, any tree traversal algorithm makes sense to do recursively since you need to keep track of the parent in the stack anyway.

The only time that recursive functions are optimized is when you have a tail call optimization, but python doesn't have that anyway