>>> def test(var=None):
... def inner():
... var = var or 'test'
... return var
... return inner
...
>>> test()()
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
/Users/piranha/<ipython console> in <module>()
/Users/piranha/<ipython console> in inner()
UnboundLocalError: local variable 'var' referenced before assignment