title: import numpy as np versus from numpy import
body: <p>I have a module that heavily makes use of <code>numpy</code>:</p>
  
  <pre><code>from numpy import array, median, nan, percentile, roll, sqrt, sum, transpose, unique, where
  </code></pre>
  
  <p>Is it better practice to keep the namespace clean by using</p>
  
  <pre><code>import numpy as np
  </code></pre>
  
  <p>and then when I need to use <code>array</code> just use <code>np.array</code>, for e.g.?</p>
  
  <p>This module also gets called repeatedly, say a few million times and keeping the namespace clean appears to add a bit of an overhead?</p>
  
  <pre><code>setup = '''import numpy as np'''
  function = 'x = np.sum(np.array([1,2,3,4,5,6,7,8,9,10]))'
  print(min(timeit.Timer(function, setup=setup).repeat(10, 300000)))
  </code></pre>
  
  <blockquote>
    <p><strong>1.66832</strong></p>
  </blockquote>
  
  <pre><code>setup = '''from numpy import arange, array, sum'''
  function = 'x = sum(array([1,2,3,4,5,6,7,8,9,10]))'
  print(min(timeit.Timer(function, setup=setup).repeat(10, 300000)))
  </code></pre>
  
  <blockquote>
    <p><strong>1.65137</strong></p>
  </blockquote>
  
  <p>Why does this add more time when using <code>np.sum</code> vs <code>sum</code>?</p>