Even if Python did tail-recursion optimization, this implementation isn&#x27;t tail-recursive so it would fail in the same way.  This version is:<p><pre><code>    def sum(li, s=0):
      if len(li) == 0:
        return s
      else:
        return sum(li[1:], li[0] + s)</code></pre>