def f(x): print 'original' if x > 0: return f(x-1) return 0g = fdef f(x): print 'new' return xprint g(5)
结果是:
originalnew4
证明了:
1.when g(5) runs, origninal `f`is called,not new `f`. 2.as 5>0,'return f(x-1)'is executed3.new`f`is called when `f(x-1)` runs. so the result is 4.