Solved by pyscorcher in post #3 
              
              
                Thank you! For the object-identity case it seems we can use 
if x in set(l):
    ...

as this uses id() (contrary to lists where .__eq__() is used).