Also, for the first example, it is a scope issue: def foo2(): def foo(a=[]): a.append('ba') return a return foo() print foo2() print foo2() print foo2() print foo2() print foo2() Gives ['ba'] ['ba'] ['ba'] ['ba'] ['ba']
Your example is pretty contrived and doesn't illustrate what he was pointing out, as you're creating a new function foo every time foo2 is called, and only calling it once.