So I'm trying to pull off a trick I actually first heard about on this site.
[i for i in range(0, 10) if True or print(i)]
The idea being that you can call an arbitrary function at every step of a listcomp by sticking it inside an "if" statement that will always return True. But that code gives a syntax error.
If I wrap the function I want to call like this, though:
def f(i):
print i
[i for i in range(0, 10) if True or f(i)]
it produces the desired output. So I was wondering what the difference is, in Python's mind, between the two, because I can't tell what it could be -- both functions return "None", right?