Will the function in python for loop be executed multiple times?
<p>Say I have the following class with a method returning a list:</p>

<pre><code>Class C():
  def f():
    return [1,2,3]
</code></pre>

<p>If I loop over the this method as follows:</p>

<pre><code>c=C()
for i in c.f():
  print i
</code></pre>

<p>Inside the for loop, will c.f() be executed multiple times? If yes, in order to get it once, do I have to do assignment outside of the loop, or there is some trivial way?</p>
