title: decorator that add variable to closure
body: <p>I want to write a decorator that inject custom local variable into function.</p>
  
  <p>interface may like this.</p>
  
  <pre><code>def enclose(name, value):
      ...
      def decorator(func):
          def wrapper(*args, **kwargs):
              return func(*args, **kwargs)
          return wrapper
      return decorator
  </code></pre>
  
  <p>expectation:</p>
  
  <pre><code>@enclose('param1', 1)
  def f():
     param1 += 1
     print param1
  f() will compile and run without error
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>2
  </code></pre>
  
  <p>Is it possible to do this in python? why?</p>