The pass keyword is the no-op keyword. He does not do anything. It is often used as a placeholder for code to be added later:
if response == "yes": pass # process "yes" case
On the other hand, the continue keyword is used to restart the loop at the breakpoint, for example:
for i in range(10): if i % 2 == 0: continue print i
This loop will only output odd numbers, since continue returns to the loop control statement ( for ) for iterations, where i is equal.
In terms of an empty for loop, you are correct that they are functionally identical. You can use any of:
for i in range(10): pass for i in range(10): continue
paxdiablo
source share