In python, I have a list that should have one and only one truthy value (that is, bool(value) is True). Is there a clever way to check for this
bool(value) is True
Here's something that ought to work for anything truthy, though it has no short-circuit. I found it while looking for a clean way to forbid mutually-exclusive arguments:
if sum(1 for item in somelist if item) != 1: raise ValueError("or whatever...")