conflict = set([B, C, D])
foos = set([x.foo for x in list])
if A in foos:
    if len(foos & conflict):
        pass
How to check constraints between elements in a list / is this Constraint Programming?