title: Can a decorator be working with a lambda expression at runtime?
body: <pre><code>def attrs(**kwds):
        def decorate(f):
            for k in kwds:
                setattr(f, k, kwds[k])
            return f
        return decorate
  
  @attrs(argument_types=(int, int,), returns=int)
  def add(a, b):
        return a + b 
  </code></pre>
  
  <p>Here I need the add() can be with the ability to show its acceptable parameter type.
  but can I do something like this in runtime?</p>
  
  <pre><code>ladd=[]
  for x in range(0,10):
  
        @attrs(argument_types=int, returns=int,default_parameter1 = x) 
        exp =  lambda : add(a,x)  
        ladd.append(exp)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>ladd=[]
  for x in range(0,10):
  
        @attrs(argument_types=int, returns=int,default_parameter1 = x) 
        addx = functools.partial(add, 2)  
        ladd.append(addx)
  </code></pre>
  
  <p>I need those function can be generated runtime with the "decoratored" parameter bind either</p>
  
  <hr>
  
  <p>Well, here is the error information, I think above code can not work, but I never tried to paste it to python to test it... </p>
  
  <pre class="lang-none prettyprint-override"><code>&gt;&gt;&gt; ladd=[]
  &gt;&gt;&gt; for x in range(0,10):
  ...     @attrs(argument_types=int, returns=int,default_parameter1 = x) 
  ...     exp =  lambda : add(a,x)  
    File "&lt;stdin&gt;", line 3
      exp =  lambda : add(a,x)  
        ^
  SyntaxError: invalid syntax
  &gt;&gt;&gt;     ladd.append(exp)
    File "&lt;stdin&gt;", line 1
      ladd.append(exp)
      ^
  IndentationError: unexpected indent
  &gt;&gt;&gt; 
  </code></pre>