Difference between generators and functions returning generators : <p>I was debugging some code with generators and came to this question. Assume I have a generator function</p>

<pre><code>def f(x):
    yield x
</code></pre>

<p>and a function returning a generator:</p>

<pre><code>def g(x):
    return f(x)
</code></pre>

<p>They surely return the same thing. Can there be any differences when using them interchangeably in Python code? Is there any way to distinguish the two (without <code>inspect</code>)?</p>
