let’s say I have the following code:
for a in object.a_really_huge_function():
print a
In order to prevent a_really_huge_function from running multiple times, I am used to doing this in other languages:
a_list = object.a_really_huge_function()
for a in a_list:
print a
Is that necessary in Python? Will the part after in run on every single loop?
The python interpreter is your friend.
In short, no, it gets called once.