Optimize the following Python code for efficiency.
def search(list, query): 
    if query in list: 
        return True 
    else: 
        return False
def search(list, query): 
    return query in list