title: Will the function in python for loop be executed multiple times?
body: <p>Say I have the following class with a method returning a list:</p>
  <pre><code>class C:
      def f(self):
          return [1,2,3]
  </code></pre>
  <p>If I loop over the list returned fro the method, as follows:</p>
  <pre><code>c = C()
  for i in c.f():
      print(i)
  </code></pre>
  <p>Inside the <code>for</code> loop, will <code>c.f()</code> 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>