Is there a short contains function for lists?
You can use this syntax: Also, inverse operator: It works fine for lists, tuples, sets and dicts (check keys). Note that this is an O(n) operation in lists and tuples, but an O(1) operation in sets and dicts.