Perhaps PyChecker or Pylint would have flagged this for you.