title: Python: error using using eval() while converting string into name of numpy array
body: <p>I have two <code>numpy</code>arrays named <code>dec_pair</code> and <code>dec_community</code> in a module named <code>config.py</code>, initialized to zero:</p>
  
  <pre><code>dec_pair = numpy.zeros(200)
  dec_community = numpy.zeros(200)
  </code></pre>
  
  <p>Now, I am trying to access them from some other module, say <code>roc.py</code>, where their names are being formed based on a input variable, i.e.</p>
  
  <pre><code>import config
  def dosomething(name):
      local_name = 'config.py'+name
      eval(local_name)[i:] += 1
  </code></pre>
  
  <p>where <code>name</code> can be <code>pair</code> or <code>community</code>. The issue is, <code>eval(local_name)</code> is returning the length of the <code>numpy</code> array i.e. <code>200</code> here and not the array itself, which gives me this error:</p>
  
  <blockquote>
    <p>ValueError: cannot slice a 0-d array</p>
  </blockquote>
  
  <p>However, when I do the same thing on the python interpreter, it runs smoothly :</p>
  
  <pre><code>&gt;&gt;&gt; dec_pair = numpy.zeros(5)
  &gt;&gt;&gt; name = 'pair'
  &gt;&gt;&gt; local_name = 'dec_'+name
  &gt;&gt;&gt; eval(local_name)
  array([ 0.,  0.,  0.,  0.,  0.])
  </code></pre>
  
  <p>Any idea as to what I am doing wrong and what would be the correct way to do it ?</p>