def bool_split(seq, predicate): """Returns two lists, the first containing all elements of `seq` for which `predicate` evaluates to false, the second all others. >>> bool_split (range (10), lambda x : x % 2) ([0, 2, 4, 6, 8], [1, 3, 5, 7, 9]) >>> bool_split (range (10), lambda x : x > 5) ([0, 1, 2, 3, 4, 5], [6, 7, 8, 9]) >>> bool_split (range (5), lambda x : x < 5) ([], [0, 1, 2, 3, 4]) >>> bool_split (range (5), lambda x : x > 4) ([0, 1, 2, 3, 4], []) """ return tuple(list(x) for x in TFL.bool_split_iters(seq, predicate))
def bool_split (seq, predicate) : """Returns two lists, the first containing all elements of `seq` for which `predicate` evaluates to false, the second all others. >>> bool_split (range (10), lambda x : x % 2) ([0, 2, 4, 6, 8], [1, 3, 5, 7, 9]) >>> bool_split (range (10), lambda x : x > 5) ([0, 1, 2, 3, 4, 5], [6, 7, 8, 9]) >>> bool_split (range (5), lambda x : x < 5) ([], [0, 1, 2, 3, 4]) >>> bool_split (range (5), lambda x : x > 4) ([0, 1, 2, 3, 4], []) """ return tuple (list (x) for x in TFL.bool_split_iters (seq, predicate))