def f():and you run it, nothing is printed.
if __name__ == "__main__":
Then you comment out the "yield" statement, and F is printed out.
I actually went a filled a bug report. I need to know better than that :)
Raymond pointed out that in the first case, the yield statement causes the function to become a generator and nothing is being run until next is called.
This means Python is behaving as expected, however I'd wish for Python or Pychecker to have a GCC like statement with no effect warning.