view Closure @ 244:eee52d5a4af8 default tip

created
author 127.0.0.1
date Sun, 30 Jun 2013 11:08:33 +0200
parents bccd43768b5f
children
line wrap: on
line source

{{{#!python
def function_factory():
    variable = []
    def function():
        variable.append(1)
        return variable
    return function

function1 = function_factory()
function2 = function_factory()
print function1()
print function1()
print function2()
}}}
----
{{{
[1]
[1, 1]
[1]
}}}