Python Comparing Lists
Question: I want to compare two lists and want to know if a element corresponds to
another element.

example: 'a' should correspond to 'b' here, it will return True.

    
    
    list1 = [a,b,c,d]
    list2 = [b,a,d,c]
    

'a' and 'b' correspond to each-other (they share the same spot on lists). how
do I make a function to return True if they correspond?

    
    
    list1 = [a,b,c,d]
    list2 = [c,d,a,b]
    

This would return False.


Answer: I would do it like this:

    
    
    >>> from operator import eq
    >>> list1 = ['a','b','c','d']
    >>> list2 = ['c','d','a','b']
    >>> any(map(eq, list1, list2))
    False
    

Of course, if you want the full boolean 'correspondence' list you can simply
omit the `any` function:

    
    
    >>> map(eq, list1, list2)
    [False, False, False, False]
    

