Python redirect return statement to stdout
<p>I am writing a Python interpreter and want to redirect the function's return values to stdout, like the Python Interpreter in Interactive Mode. Within this mode, when the user calls a function, its return value is printed on the screen. The same occurs with expressions.</p>

<p>E.g.</p>

<pre><code>&gt;&gt;&gt; foo()
'Foo return value'
&gt;&gt;&gt; 2+4
6
&gt;&gt;&gt; print('Hello!')
'Hello!'
</code></pre>

<p>Changing the <code>sys.stdout</code> only affects the <code>print</code> function. How do I redirect the other expressions to stdout?</p>

<p>Thank you</p>
