>>> def sum(x, y): ... def do_it(): ... return x + y ... return do_it ... >>> a = sum(1, 3) >>> a <function do_it at 0xb772b304> >>> a() 4
Is this what you were looking for? It's called a closure.
1.4m articles
1.4m replys
5 comments
57.0k users