remove_last_matching

emlib.misc.remove_last_matching(seq, func)[source]

Remove last element of seq matching the given condition, in place

Parameters:
  • seq (list[TypeVar(T)]) – the list to modify

  • func (Callable[[TypeVar(T)], bool]) – a function taking an element of seq, should return True if this is the element to remove

Return type:

Optional[TypeVar(T)]

Returns:

the removed element, or None if the condition was never met