Use underscore builtin in script
<p>In an interactive console (in Python) I can do this;</p>

<pre><code>k = 5
def generateur(i):
    i += 1
    yield i

for j in generateur(k):
    j

print _
</code></pre>

<p>Where the <code>_</code> variable take latest value. This could be very useful for me, when I loop through a generator and would like raise an exception and print the wrong statement by example. However, <code>_</code> doesn't seem to be available when you run a script - e. g. <code>$ python my_script.py</code>. (I have tried to use <code>__builtin__._</code> but it fails.)</p>

<p>Is there a way to access <code>_</code> when running a script?  If not, what alternatives are there that I could take advantage of?</p>
