Just add that if your truth value can vary, for example, if it is input from different programming languages ββor from different types, a more reliable method would be:
flag = value in ['True','true',1,'T','t','1']
And a more productive option would be (set lookup O (1)):
TRUTHS = set(['True','true',1,'T','t','1']) flag = value in truths
Daniel Dubovski Apr 28 '19 at 10:20 2019-04-28 10:20
source share