title: Heapify a list with arrays in Python
body: <p>I am trying to build a list with the following format:</p>
  
  <p>(t,dt,array)</p>
  
  <p>Where t is time -float-, dt is also a float an array is an array of ints that represents the state of my system. I want to have elements ordered in an array by the first element, that is t. So my take on it is to use the heap structure provided by Python. </p>
  
  <p>What I am trying is:</p>
  
  <pre><code>import numpy as np 
  import scipy as sp
  import matplotlib.pyplot as plt
  import heapq
  
  popsize = 10
  
  populat = [ (0,0,np.random.randint(0,2,Nsize)) for count in range(popsize)]
  heapq.heapify(populat)  # Structure to order efficiently 
  </code></pre>
  
  <p>However this returns the following:</p>
  
  <p><b> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() </b></p>
  
  <p>So does anybody knows how could it do that? or where does the error comes from?</p>
  
  <p>I am using Ubuntu 12.04, running python 2.7 and also ipython 1.1.</p>
  
  <p>I will be very grateful, thanks a lot.</p>