title: What's wrong with my Python?
body: <p>I've put together this script to help me perform a search across specific files. It does something similar to grep, but I needed something a little more specific than what grep offers, so I'm trying my hand at Python. </p>
  
  <p>I've got one class which has three methods. The second method <code>listOccurrencesOfToDoInFile</code> (on line 30) fails. It's a small script, but since tabs matter in Python, I've put it into a <a href="https://gist.github.com/MosheBerman/5766196" rel="nofollow">a gist, here</a>. Can anyone tell my why my seemingly valid Python is invalid?</p>
  
  <pre><code>import os
  import keyword
  import sys
  
  
  class Toodles:
  
      def walkAndList(directory):
          for dirname, dirnames, filenames in os.walk(directory):
  
              # print path to all filenames.
              for filename in filenames:
                  workingFilename = os.path.join(dirname, filename)
                  if(isSourceFile(filename)):
                      listOccurrencesOfToDoInFile(filename)
  
              # Advanced usage:
              # editing the 'dirnames' list will stop os.walk() from recursing into there.
              if '.git' in dirnames:
                  # don't go into any .git directories.
                  dirnames.remove('.git')
  
              for dirs in dirnames:
                  self.walkAndList(os.path.join(dirname, dirs)
  
  
      #   Find occurences of "todo" and "fixme" in a file
      #   If we find such an occurence, print the filename, 
      #   the line number, and the line itself.
      def listOccurrencesOfToDoInFile(aFileName):
          input = open(aFileName)
          currentLine = 1
          for (line in input):
              line = line.lower()
              currentLine = currentLine + 1
              needle = "todo"
              if (needle in line):
                  sys.stdout.write(aFileName + " (" + str(currentLine) + ")" + line)
  
      #Todo: add a comment
      def isSourceFile(self, name):
          fileName, fileExtension = os.path.splitext(name)
          if (".m" in fileExtension or ".c" in fileExtension or ".h" in fileExtension):
              return True
          return False
  
  
  if ( __name__ == "__main__") {
      a = Toodles()
      a.walkAndList('.')
  }   
  </code></pre>