Primitives¶
-
isnone
(x)¶ Checks if
x
isNone
. Handy with filtering functions:remove(isnone, list_of_dirty_data)
Plays nice with
silent()
, which returnsNone
on fail:remove(isnone, imap(silent(int), strings_with_numbers))
Note that it’s usually simpler to use
keep()
orcompact()
if you don’t need to distinguish betweenNone
and other falsy values.
-
notnone
(x)¶ Checks if
x
is notNone
. A shortcut forcomplement(isnone)
meant to be used whenbool
is not specific enough. Compare:select_values(notnone, data_dict) # removes None values compact(data_dict) # removes all falsy values
-
inc
(x)¶ Increments its argument by 1.
-
dec
(x)¶ Decrements its argument by 1.
-
even
(x)¶ Checks if
x
is even.
-
odd
(x)¶ Checks if
x
is odd.