title: How do I assign a value to a multidimensional array element in a function with index and value as parameters
body: <p>I am trying to do something simple (i think). However, I obviously don't understand something about what is going on.</p>
  
  <ul>
  <li>I have a class that creates a multidimensional array</li>
  <li>I want methods to get and set elements of the array by passing the array index and value to  methods of the class.</li>
  <li><p>Here is the code. </p>
  
  <pre><code>from numpy import *
  
  class Space():
      def __init__(self, shape, mode):
          self.space = ndarray(shape, dtype=list )
          self.mode = mode
  
      def get(self, elem) :
          return(self.space[elem])
  
      def set(self, elem, val):
          self.space[elem] = val        
  shape = [2,2,2]
  s = Space(shape, 'wrap')
  s.set([1,1], [2,2])
  print s.get([1,1])
  </code></pre></li>
  </ul>
  
  <p>This should be a straight forward process. I am obviously not understanding something rather basic here. An explanation of what is going on and what to do would be greatly appreciated. Thanks.</p>