I want to check if my list of objects contain an object with a certain attribute value.
class Test: def __init__(self, name): self.name = name
As you can easily see from the documentation, the any() function short-circuits an returns True as soon as a match has been found.
any()
True
any(x.name == "t2" for x in l)