Q:

indexing a list where there is no match in python

I have two separate lists (of lists) that can potentially have overlapping values.  Each list has a date.  I would like to modify mylist1 so that the date (item[3]) is the minimum of the date from mylist1 and the corressponding date in mylist2.  The problem I am running into is that when there is no match, I get an error: IndexError: list index out of range.  In these cases, I would just like to not take the minimum, but instead just use the date in mylist1.  Is there some sort of if error clause that I can put around it? 
My Code:
mylist1 = [[u'AAA', None, u'111', u'1/1/2015'],
           [u'BBB', None, u'222', u'1/1/2012'],
           [u'CCC', None, u'333', u'1/1/2012']]

mylist2 = [(u'111', u'1/1/2011'),
           (u'333', u'2013-11-10'),
           (u'444', u'1/1/2017')]

for key, item in enumerate(mylist1):
     mylist1[key] = [item[0], item[1], item[2],
                     min(item[3], [x for x in mylist2 if x[0] == item[2]][0][1])]

Desired output:
[[u'AAA', None, u'111', u'1/1/2011'],
 [u'BBB', None, u'222', u'1/1/2012'],
 [u'CCC', None, u'333', u'1/1/2012']]

A:

If I got this right, your mylist2 is kinda used as a dictionary.  Why not just make it one:
mylist1 = [[u'AAA', None, u'111' ,u'1/1/2015'], [u'BBB', None, u'222' ,u'1/1/2012'], [u'CCC', None, u'333' ,u'1/1/2012']]
mylist2 = [(u'111', u'1/1/2011'), (u'333', u'2013-11-10'), (u'444', u'1/1/2017')]
# assuming, you are not responsible for the form of mylist2,
# we will change it into a dictionary here:
mydict = dict(mylist2)   # easy :)
for elem_list in mylist1:
    elem_list[3] = min(elem_list[3], mydict.get(elem_list[2], elem_list[3]))

elem_list is a reference to the list, so we don't need the index of it in mylist1 as a change in it will persist.  This makes the rest of the last line easier, as we do not have to re-build the original list.  The mydict.get prevents the error, if the desired element is not available.