title: Python class static methods
body: <p>I want to create a kind of utility class which contains only static methods which are callable by the name class prefix. Looks like I'm doing something wrong :)</p>
  
  <p>Here is my small class:</p>
  
  <pre><code>class FileUtility():
  
      @staticmethod
      def GetFileSize(self, fullName):
          fileSize = os.path.getsize(fullName)
          return fileSize
  
      @staticmethod
      def GetFilePath(self, fullName):
          filePath = os.path.abspath(fullName)
          return filePath
  </code></pre>
  
  <p>Now my "main" method:</p>
  
  <pre><code>from FileUtility import *
  def main():
          path = 'C:\config_file_list.txt'
          dir = FileUtility.GetFilePath(path)
          print dir
  </code></pre>
  
  <p>and I got an error: <code>unbound method GetFilePath() must be called with FileUtility instance as first argument (got str instance instead)</code>.</p>
  
  <p>A have a few questions here:</p>
  
  <ol>
  <li>What am I doing wrong? Should not the static method be callable by classname?</li>
  <li>Do I really need a utility class, or are there other ways to achieve the same in Python?</li>
  <li>If I try to change the code in main I'm getting: <code>TypeError: GetFilePath() takes exactly 1 argument (2 given)</code></li>
  </ol>
  
  <p>The new <code>main</code>:</p>
  
  <pre><code>from FileUtility import *
  def main():
      objFile = FileUtility()
      path = 'H:\config_file_list.txt'
      dir = objFile.GetFilePath(path)
      print dir
  </code></pre>