title: Why am I getting NameError: name 'array' is not defined
body: <p>I'm using spyder and have written the following class:</p>
  
  <pre><code>class Ray:
  
      def __init__(self, r, p, k):
  
          if r.shape == (3,):
              self.r = r
          if p.shape == (3,):
              self.p = p
          if k.shape == (3,):
              self.k = k
  
  r = array(range(3))
  p = array(range(3))
  k = array(range(3))
  </code></pre>
  
  <p>It is stored in /home/user/workspace/spyder/project and the console working directory is that one. In the console I can run an array(range(3)) and it returns an array with values 0,1,2. However when doing</p>
  
  <pre><code>import ray
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "ray.py", line 8, in &lt;module&gt;
      class Ray:
    File "ray.py", line 20, in ray
      r = array(range(3));
  NameError: name 'array' is not defined
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>by default spyder has the following behaviour, don't really understand why array() works by default I thought it was only part of numpy.</p>
  
  <pre><code>import numpy as np  # NumPy (multidimensional arrays, linear algebra, ...)
  import scipy as sp  # SciPy (signal and image processing library)
  
  import matplotlib as mpl         # Matplotlib (2D/3D plotting library)
  import matplotlib.pyplot as plt  # Matplotlib's pyplot: MATLAB-like syntax
  from mayavi import mlab          # 3D plotting functions
  from pylab import *              # Matplotlib's pylab interface
  ion()                            # Turned on Matplotlib's interactive mode
  
  Within Spyder, this intepreter also provides:
      * special commands (e.g. %ls, %pwd, %clear)
      * system commands, i.e. all commands starting with '!' are subprocessed
        (e.g. !dir on Windows or !ls on Linux, and so on)
  </code></pre>