inject_items¶
-
privex.helpers.common.inject_items(items: list, dest_list: list, position: int) → List[str][source]¶ Inject a list
itemsafter a certain element indest_list.NOTE: This does NOT alter
dest_list- it returns a NEW list withitemsinjected after the givenpositionindest_list.Example Usage:
>>> x = ['a', 'b', 'e', 'f', 'g'] >>> y = ['c', 'd'] >>> # Inject the list 'y' into list 'x' after element 1 (b) >>> inject_items(y, x, 1) ['a', 'b', 'c', 'd', 'e', 'f', 'g']