title: Python Printing a Deque
body: <p>I have an entire Deque Array class that looks like this: </p>
  
  <pre><code>from collections import deque
  import ctypes
  
  class dequeArray:
  
  DEFAULT_CAPACITY = 10  #moderate capacity for all new queues
  
  def __init__(self):
      self.capacity = 5
      capacity = self.capacity
      self._data = self._make_array(self.capacity)
      self._size = 0
      self._front = 0
  
  def __len__(self):
      return self._size
  
  def __getitem__(self, k):   #Return element at index k
      if not 0 &lt;= k &lt; self._size:
          raise IndexError('invalid index')
      return self._data[k]
  
  def isEmpty(self):
      if self._data == 0:
          return False
      else:
          return True
  
  def append(self, item):  #add an element to the back of the queue
      if self._size == self.capacity:
          self._data.pop(0)
      else:
          avail = (self._front + self._size) % len(self._data)
          self._data[avail] = item
          self._size += 1
  
  #def _resize(self, c):
      #B = self._make_array(c)
      #for k in range(self._size):
          #B[k] = self._A[k]
      #self._data = B
      #self.capacity = capacity
  
  def _make_array(self, c):
      capacity = self.capacity
      return (capacity * ctypes.py_object)()
  
  def removeFirst(self):
      if self._size == self.capacity:
          self._data.pop(0)
      else:
          answer = self._data[self._front]
          self._data[self._front] = None
          self._front = (self._front + 1) % len(self._data)
          self._size -= 1
          print(answer)
  
  
  def removeLast(self):
      return self._data.popleft()
  
  def __str__(self):
      return str(self._data)
  </code></pre>
  
  <p>and when I try to print the deque in the main it prints out something like this, </p>
  
  <pre><code>&lt;bound method dequeArray.__str__ of &lt;__main__.dequeArray object at   0x1053aec88&gt;&gt;
  </code></pre>
  
  <p>when it should be printing the entire array. I think i need to use the <strong>str</strong> function and i tried adding</p>
  
  <pre><code>def __str__(self):
      return str(self._data)
  </code></pre>
  
  <p>and that failed to give me the output. I also tried just</p>
  
  <pre><code>def __str__(self):
      return str(d)
  </code></pre>
  
  <p>d being the deque array but I still am not having any success. How do I do i get it to print correctly?</p>