list_safe_remove#

caf.toolkit.toolbox.list_safe_remove(lst, remove, throw_error=False, inplace=False)[source]#

Remove items from a list without raising an error.

Parameters:
  • lst (list[Any]) – The list to remove items from

  • remove (list[Any]) – The items to remove from lst

  • throw_error (bool) – Whether to raise an error or not when an item in remove is not contained in lst

  • inplace (bool) – Whether to remove the items in-place, or return a copy of lst

Returns:

lst with removed items removed from it

Return type:

lst