title: Generate a new function from an existing one with fewer arguments
body: <p>I thought that it would make my code simpler and easier to read if I could generate a new function from an existing one, by substituting one of its argument. In a MWE below I used a summation function and tried to implement a way similar to decorators where a=5 is hard coded into function. Unfortunately I can not interpret correctly the traceback.</p>
  
  <pre><code>def sum(a,b):
      return a+b
  
  foo = sum
  print(foo(2,3))
  
  def new_sum(func, *args,**kwargs):
      def wrapper(func, *args,**kwargs):
          x = func(5, *args, **kwargs)
          return x
      return wrapper
  
  bar = new_sum(func=sum)
  print(bar(1))
  </code></pre>
  
  <p>It returns:</p>
  
  <pre><code>$ python3 func_arg.py
  5
  Traceback (most recent call last):
    File "func_arg.py", line 14, in &lt;module&gt;
      print(bar(1))
    File "func_arg.py", line 9, in wrapper
      x = func(5, *args, **kwargs)
  TypeError: 'int' object is not callable
  </code></pre>