Closure

A closure is a block of code that can be passed as an argument to a function call.Typically, a closure occurs when one function appears entirely within the body of another, and the inner function refers to local variables of the outer function.

>>> def my_fn(x):
        return lambda y:  x > y     

Here the variable 'x' lives on beyond the scope of my_fn().

>>> f = my_fn(10)
>>> f(10)
False
>>> f(9)
True