On Jul 28, 2015 1:36 PM, "Paul Rubin" <no.email@nospam.invalid> wrote: > > Paul Rubin <no.email@nospam.invalid> writes: > > Chris Angelico was asking for examples of tail recursion that didn't > > have obvious looping equivalents. Here's an Euler problem solution > > using memoization and (except that Python doesn't implement it) tail > > recursion with an accumulator. > > Actually that's wrong, it's not really tail recursive because of the > addition in the memo combinator, whoops ;-).
Not just the addition, but the setdefault call as well. Without the addition that call could be tail-call optimized, but that's not the recursive call; the call to func is.
-- https://mail.python.org/mailman/listinfo/python-list