title: python and palindromes
body: <p>i recently wrote a method to cycle through <code>/usr/share/dict/words</code> and return a list of palindromes using my <code>ispalindrome(x)</code> method
  here's some of the code...what's wrong with it? it just stalls for 10 minutes and then returns a list of all the words in the file</p>
  
  <pre>
  def reverse(a):
      return a[::-1]
  
  def ispalindrome(a):
      b = reverse(a)
      if b.lower() == a.lower():
          return True
      else:
          return False
  
  wl = open('/usr/share/dict/words', 'r')
  wordlist = wl.readlines()
  wl.close()
  for x in wordlist:
      if not ispalindrome(x):
          wordlist.remove(x)
  print wordlist
  </pre>