title: How to implement a tree structure in Python using namedtuple
body: <p>I have a key-word, e.g. friendly. It gives birth to a child-word, e.g. warm, while descending from a parent-word, e.g. friend. </p>
  
  <pre><code>from collections import namedtuple
  
  keyword = 'friendly'
  childword = 'warm'
  parentword = 'friend'
  
  connect=namedtuple(keyword,'children parents')
  output = connect([childword],[parentword])  
  </code></pre>
  
  <p>As a result, I can use output.children to see what are the children of my nodeword. However, what I really want to do is to type</p>
  
  <pre><code>friendly.children # instead of output.children
  </code></pre>
  
  <p>to see the children of the key-word friendly. How can I do this? I am completely new to Python; I am not even sure if this is doable. </p>