title: Python-filtering list of objects
body: <p>I have created a class as below and have created data list which holds object of this class.</p>
  
  <pre><code>class  flight:  
      origin = ""
      dest = ""
      depdelay = 0
      arrdelay = 0
      dist = 0
  </code></pre>
  
  <p>I am trying to make groups and filtering based on certain criteria as below-</p>
  
  <pre><code>x=0
  grouping = []
  for i in range (0,12):
  
    group = filter(lambda s:s.dist &gt;=(x+1) and s.dist &lt;= (x+200),data)
    total2 = len(list(group))
    print(total2)
    subgroup = filter(lambda r:r.arrdelay == 0,group)
    subgroup = filter(lambda r:r.depdelay == 0,subgroup)
    subgroup = list(subgroup)
    print(len(subgroup))
    ontimegroup = len(subgroup)/total2
    grouping.append(ontimegroup)
    x=x+200
  </code></pre>
  
  <p>on doing this I am able to filter data in group but after that i get a blank list.My data has arrdelay ==0 and depdelay ==0. </p>
  
  <p>Not sure what is wrong here and why i am getting a null list in subgroup.</p>