"Terry Reedy" <tjreedy at home.com> writes: > def f(val): > global f > f = val and f1 or f2 > return f(val) This is not tail recursion. The "global f" declaration shadows the "f" that names the function.