is_false¶
-
privex.helpers.common.
is_false
(v, chk_none: bool = True) → bool[source]¶ Warning: Unless you specifically need to verify a value is Falsey, it’s usually safer to check for truth
is_true()
and invert the result, i.e.if not is_true(v)
Check if a given bool/str/int value is some form of
False
:bool:
False
str:
'false'
,'no'
,'n'
,'0'
int:
0
If
chk_none
is True (default), will also consider the below values to be Falsey:boolean: None // string: 'null', 'none', ''
(note: strings are automatically .lower()’d)
Usage:
>>> is_false(0) True >>> is_false('yes') False
- Parameters
v (Any) – The value to check for falseyness
chk_none (bool) – If
True
, treatNone
/'none'
/'null'
as Falsey (defaultTrue
)
- Return bool is_False
True
if the value appears to be falsey, otherwiseFalse
.