title: How to hash *args **kwargs for function cache?
body: <p>I'm working with <code>xlwt</code> which has a 4k limit on how many styles can be defined in an excel doc.</p>
  
  <p>Normally, one creates styles like so:</p>
  
  <pre><code>style = xlwt.easyxf("font: bold 1")
  </code></pre>
  
  <p>Which I simply replaced with</p>
  
  <pre><code>def cached_easyxf(self, format):
      return self._cache.setdefault(format, xlwt.easyxf(format))
  </code></pre>
  
  <p>Which works perfectly. Now, I've found out that I need to pass in keyword arguments sometimes which got me thinking: how should I hash the args/kwargs signature?</p>
  
  <p>Should I create a cache key based on str(value)? Pickle? What's most robust?</p>
  
  <p>For my situation it looks like I can just convert key/values to strings and add it to my keys... but I'm now curious about a generic way to handle this with say unhashable types like <code>arg=[1, 2, 3]</code></p>
  
  <pre><code>def cached_call(*args, **kwargs):
      return cache.get(what_here)
  cached_call('hello')
  cached_call([1, 2, 3], {'1': True})
  </code></pre>