title: Mutable default argument for a Python namedtuple
body: <p>I came across a neat way of having namedtuples use default arguments from <a href="https://stackoverflow.com/a/18348004/2529619">here</a>.</p>
  
  <pre><code>from collections import namedtuple
  Node = namedtuple('Node', 'val left right')
  Node.__new__.__defaults__ = (None, None, None)
  Node()
  </code></pre>
  
  <blockquote>
    <p>Node(val=None, left=None, right=None)</p>
  </blockquote>
  
  <p>What would you do if you would want the default value for 'right' to be a empty list? As you may know, using a mutable default argument such as a list is a no no. </p>
  
  <p>Is there a simple way to implement this?</p>