Search a list of objects in Python
<p>I have a list of Item objects that have a date attribute.  I also have a a single date I am grabbing from the database.  </p>

<p>I want to search through the list, find all of the list items that are greater than the date I have returned from the database.  </p>

<p>My list of Items objects has over a thousand objects in it, so I want to be as efficient as possible.  </p>

<p>I assume that looping over every item in my list and checking if it is greater than the date I returned from the db is not the most efficient way to do this.</p>

<pre><code>class Item(object):    
    def __init__(self, title, link, description, date):
        self.title = title
        self.link = link
        self.description = description
        self.date = date

item_list = [] 
...
#assume I populate the list with a 1,000 Item objects

filtered_list = []
for it in item_list:
    if date_from_db &gt; it.date:
        filtered_list.append(it)
</code></pre>
