I'm searching the fastest way to find a common item between two lists in Python. These lists have the same length, contain integers (at least 10k) and are unordered. After searched for a while I reached this solution:
def common_item(l1, l2):
s = None
l2 = set(l2)
for i in l1:
if i in l2:
s = i
break
return s
My goal (if possible) is to improve the code. Any suggestions are welcome.
Edit: I forgot to mention that there is at most one item in common.