inject_items¶
-
privex.helpers.common.
inject_items
(items: list, dest_list: list, position: int) → List[str][source]¶ Inject a list
items
after a certain element indest_list
.NOTE: This does NOT alter
dest_list
- it returns a NEW list withitems
injected after the givenposition
indest_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']