Accessing variables by their names in a tuple
<p>I need to access variables given their names, in the following way:</p>

<pre><code>a = numpy.array([1,2,3])
b = numpy.array([4,5,6])
names = ('a', 'b')
</code></pre>

<p>Then, I pass the variable <code>names</code> to a function, say numpy.hstack() to obtain the same result as with <code>numpy.hstack((a,b))</code>.</p>

<p>What is the best pythonic way to do so?</p>

<p>And what is the purpose? I have a function, that accepts names of numpy arrays and stacks the related arrays (defined in the function) together to process them. I need to create all possible combinations of these arrays, hence:</p>

<ol>
<li>A combination (tuple) of array names is created.</li>
<li>The combination (tuple) is passed to a function as an argument.</li>
<li>The function concatenates related arrays and processes the result.</li>
</ol>

<p>Hopefully this question is not too cryptic. Thanks for responses in advance :-)</p>
