1 2 3 4 5 6 7
try: reduce except NameError: from functools import reduce def xor(*things): return reduce(lambda x, y: bool(x) ^ bool(y), things)