In general, you're right - if speed is a concern, loops should be used
instead of recursion in Python when possible.

In this case, the recursive overhead is insignificant compared to the
expense of iterating over the sequence at every iteration.  By the time
there are 70 stack frames of recursion (i.e. not much), the sequence is
more than 170 million elements long.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to