Make config_loadfile augment cmdline instead of klobbering.
[python_utils.git] / list_utils.py
index 9a5d4fde0dcad7936a16ffc6f53a7a50ba0b67fa..7d3355cc85a72a047aacaa0c3f06430a9e8e8dd7 100644 (file)
@@ -15,10 +15,15 @@ def flatten(lst: List[Any]) -> List[Any]:
 
         >>> flatten([ 1, [2, 3, 4, [5], 6], 7, [8, [9]]])
         [1, 2, 3, 4, 5, 6, 7, 8, 9]
-
     """
     if len(lst) == 0:
         return lst
     if isinstance(lst[0], list):
         return flatten(lst[0]) + flatten(lst[1:])
     return lst[:1] + flatten(lst[1:])
+
+
+def prepend(item: Any, lst: List[Any]) -> List[Any]:
+    """Prepend an item to a list."""
+    lst = list.insert(0, item)
+    return lst