title: How can I apply a namedtuple onto a function?
body: <p>In Python, if you have a dictionary</p>
  
  <pre><code>d = {'foo': 1, 'bar': False}
  </code></pre>
  
  <p>You can apply this onto a function that accept <code>foo</code> and <code>bar</code> keyword arguments by</p>
  
  <pre><code>def func(foo, bar):
      # Do something complicated here
      pass
  
  func(**d)
  </code></pre>
  
  <p>But if instead, I wanted to call <code>func</code> with the namedtuple defined below:</p>
  
  <pre><code>from collections import namedtuple
  Record = namedtuple('Record', 'foo bar')
  r = Record(foo=1, bar=False)
  func(r)   # !!! this will not work
  </code></pre>
  
  <p>What's the syntax for this?</p>