title: Freezing Function Arguments
body: <p>I am trying to write a class that gives the functionality of the input function, but remembers the arguments from last call and will only update them like a dictionary. I have this so far but I would love to know if there is a better way:</p>
  
  <pre><code>class freezefunc:
      def __init__(self, func, **funcargs):
          self.func = func
          self.funcargs = {}
  
      def call(self, **kwargs):
          self.funcargs.update(kwargs)
          self.func(**self.funcargs)
  </code></pre>
  
  <p>So this works like this then:</p>
  
  <pre><code>def func(a):
      print a
  frozenfunc = freezefunc(func)
  frozenfunc.call(a='somevalue')
  </code></pre>
  
  <p>prints: somevalue</p>
  
  <pre><code>frozenfunc.call(a='theupdatedvalue')
  </code></pre>
  
  <p>prints: theupdatedvalue</p>
  
  <p>Is there something like this that I just haven't found? </p>
  
  <p>UPDATDE: the function <a href="https://docs.python.org/2/library/functools.html#functools.partial" rel="nofollow noreferrer">partial</a> from the library <a href="https://docs.python.org/2/library/functools.html" rel="nofollow noreferrer">functools</a> performs very much the same task.</p>