title: Root node operations in tree data structures
body: <p>Need a way to indicate/enforce that certain methods can only be done on the root <code>Node</code> of my tree data structure.  I'm working in Python 2.x</p>
  
  <p>I have a class, Node, which I use in conjunction with another class, Edge, to build a tree data structure (edges are letters and nodes are words, in this case).</p>
  
  <p>Some methods in Node are needed for every instance of the Node, like <code>get_word</code>, which runs backwards through the tree to determine the word being represented by that Node.  But other Node operations, like <code>load_word_into_tree</code>, seem more like a class methods -- they operate on the entire tree.  Furthermore, the way I have structured the that call, it requires the root node and the root node only as its input.  If it is called on any other node, it'll totally mess up the tree.</p>
  
  <p>I see two options:</p>
  
  <ul>
  <li><p>Make <code>load_word_into_tree</code> an instance method, but raise an error if it is called on any Node that isn't the root.  I'm leaning towards this, but something just seems not right about it.  In my mind, instance methods are methods that every instance should need, and to have this method tacked on to every Node when it can only ever be used for the root seems like a waste.</p></li>
  <li><p>Make <code>load_word_into_tree</code> a class method, but pass it the root node as an arg.  This gets around the problem of a 'wasteful' instance method, but also seems like a misuse of concept of a class method, since it takes a single node as its input.  Furthermore, I'm not sure what use I'd have for the required <code>cls</code> variable available to every class method.  </p></li>
  </ul>
  
  <p>Any help on where and how to implement this function would be greatly appreciated.</p>