I want to see if a namedtuple exists in a list, similar to:
numbers = [1, 2, 3, 4, 5]
if 1 in numbers:
do_stuff()
is there a pythonic (or not) way to do this? Something like:
namedtuples = [namedtuple_1, namedtuple_2, namedtuple3]
if (namedtuple with value x = 1) in namedtuples:
do stuff()
Use
any
:Demo: