How to define a temporary variable in python?
<p>Does python have a "temporary" or "very local" variable facility?  I am looking for a one-liner and I want to keep my variable space tidy.</p>

<p>I would like to do something like this:</p>

<pre><code>...a, b, and c populated as lists earlier in code...
using ix=getindex(): print(a[ix],b[ix],c[ix])
...now ix is no longer defined...
</code></pre>

<p>The variable ix would be undefined outside of the one line.</p>

<p>Perhaps this pseudo-code is more clear:</p>

<pre><code>...a and b are populated lists earlier in code...
{ix=getindex(); answer = f(a[ix]) + g(b[ix])}
</code></pre>

<p>where ix does not exist outside of the bracket.</p>