I have some confusion over testing values that are assigned False, True
To check for True value, we can simply just
a = True
if (a):
<
To check for if a value is true:
if a:
pass
To check if a value is not true:
if not a:
pass
However, not a:
is True
(and true) for values other than False
, eg. None
, 0
, and empty containers.
If you want to check if a value is True
or False
(although you generally don't) try:
if a is True:
pass
or
if a is False:
pass
Edit: for checking if a value is True
or False
it seems you should use if isinstance(a, bool) and a
, and if isinstance(a, bool) and not a