title: varargs in lambda functions in Python
body: <p>Is it possible a lambda function to have variable number of arguments? 
  For example, I want to write a metaclass, which creates a method for every method of some other class and this newly created method returns the opposite value of the original method and has the same number of arguments.
  And I want to do this with lambda function. How to pass the arguments? Is it possible?</p>
  
  <pre><code>class Negate(type):
      def __new__(mcs, name, bases, _dict):
          extended_dict = _dict.copy()
          for (k, v) in _dict.items():
              if hasattr(v, '__call__'):
                  extended_dict["not_" + k] = lambda s, *args, **kw:  not v(s, *args, **kw)
          return type.__new__(mcs, name, bases, extended_dict)
  
  class P(metaclass=Negate):
      def __init__(self, a):
          self.a = a
  
      def yes(self):
          return True
  
      def maybe(self, you_can_chose):
          return you_can_chose
  </code></pre>
  
  <p>But the result is totally wrong:</p>
  
  <pre><code>&gt;&gt;&gt;p = P(0)
  &gt;&gt;&gt;p.yes()
  True
  &gt;&gt;&gt;p.not_yes()     # should be False
  Traceback (most recent call last):
    File "&lt;pyshell#150&gt;", line 1, in &lt;module&gt;
      p.not_yes()
    File "C:\Users\Desktop\p.py", line 51, in &lt;lambda&gt;
      extended_dict["not_" + k] = lambda s, *args, **kw:  not v(s, *args, **kw)
  TypeError: __init__() takes exactly 2 positional arguments (1 given)
  &gt;&gt;&gt;p.maybe(True)
  True
  &gt;&gt;&gt;p.not_maybe(True)     #should be False
  True
  </code></pre>