There is no harm in this:
if False in [a, b, c, d]
This is more or less equivalent:
for i in [a, b, c, d]: if i == False: return True return False
but it only checks for a False literal. It does not check objects that are "false", i.e. They behave as False in the if state. Examples of other values ββthat are false are empty strings, empty lists, or None .
For more information about documents, see the documents: Checking the value of truth
If you just want to check if the list contains any fake item, use:
if not all([a, b, c, d])
which is as follows:
for i in [a, b, c, d]: if not i: return True return False
which usually you want.
source share