def foo(a): print(\"I\'m foo\") return False if foo: print(\"OK\") else: print(\"KO\")
I run it and it returns OK. I know, I should h
When you write
if foo: print("OK") else: print("KO")
you are actually testing if the function pointer foo. It is defined, so it prints "OK" and it does not call the function. With the parenthesis, you call the foo function and runs its code.
foo