⬅︎ Back to niceboolean() - converts what you say to what you mean
I don't understand what you mean. Please explain. Certainly the above code can be done in different ways but what's interesting is what it can do. Here is some output from a unit test: False -> False True -> True 1 -> True 0 -> False '1' -> True '0' -> False 'On' -> True 'Off' -> False 'False' -> False 'No' -> False 'Yes' -> True 'T' -> True 'F' -> False
To catch errors early, you could explicitly check for `trueness' and raise ValueError when `value' is in neither list.
Comment
I don't understand what you mean. Please explain. Certainly the above code can be done in different ways but what's interesting is what it can do. Here is some output from a unit test:
False -> False
True -> True
1 -> True
0 -> False
'1' -> True
'0' -> False
'On' -> True
'Off' -> False
'False' -> False
'No' -> False
'Yes' -> True
'T' -> True
'F' -> False
Parent comment
To catch errors early, you could explicitly check for `trueness' and raise ValueError when `value' is in neither list.