title: Python 2: Wrapper with argument evaluated at runtime
body: <p>I'm really at a loss here. I need to pass arguments to the wrapper; these arguments change with runtime. Any idea how this could be solved using wrappers for classes?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>def wrapper(x=None):
      def decorate(cls):
          def fct(self):
              print('wrapper argument is: %s' % x)
          cls.fct = fct
          return cls
      return decorate
  
  a = 'first'
  
  
  @wrapper(x=a)
  class Test():
      pass
  
  test = Test()
  test.fct()  # Prints: first
  
  a = 'second'
  test.fct()   # Prints: first (instead of second)</code></pre>
  </div>
  </div>
  </p>