title: Grouping related functions in Python
body: <p>Suppose I have a module with functions <code>spam</code> and <code>ham</code> which use functions <code>eggs</code> and <code>foo</code>.</p>
  
  <pre><code>def spam():
      eggs()
      foo()
      ...
  
  def ham():
      eggs()
      foo()
      ...
  </code></pre>
  
  <p>Now, <code>eggs</code> and <code>foo</code> are only used by <code>spam</code> and <code>ham</code>, and so it doesn't make sense to expose them at the module level. I could change their names to <code>_eggs</code> and <code>_foo</code> to indicate that they are for internal use but this doesn't really establish the relation between <code>spam</code>, <code>ham</code>, <code>eggs</code> and <code>foo</code>.</p>
  
  <p>So, I could make a container class to hold these functions like this:</p>
  
  <pre><code>class SpamHam:
  
      @staticmethod
      def _eggs():
          ...
  
      @staticmethod
      def _foo():
          ...
  
      @staticmethod
      def spam():
          ...        
  
      @staticmethod
      def ham():
          ...
  </code></pre>
  
  <p>But this seems skethy because I expect users not to instantiate <code>SpamHam</code> and only use it to call the static methods. Plus it doesn't really seem right to use a class when all I want is to establish some relation between its methods.</p>
  
  <p>I could create a separate module called <code>spamham</code> and put these four functions into that, but <code>spam</code> and <code>ham</code> really do 'belong' to the module they are already in.</p>
  
  <p>So, what is correct way to establish such relations in Python?</p>