macpie.lltools.rtrim_longest#
- macpie.lltools.rtrim_longest(*seqs, predicate=None, fillvalue=None)#
Remove trailing elements from each sequence as long as predicate is true. If the resulting sequences are of uneven length, missing values are filled in with fillvalue.
- Parameters:
- seqsobjects that are acceptable to the built-in
reversed()function
- seqsobjects that are acceptable to the built-in
Examples
>>> lst1 = [1, 2, 3, None, None] >>> lst2 = [1, 2, None, None] >>> trimmed = rtrim_longest(lst1, lst2) >>> list(trimmed[0]) [1, 2, 3] >>> list(trimmed[1]) [1, 2, None]