projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Make config_loadfile augment cmdline instead of klobbering.
[python_utils.git]
/
list_utils.py
diff --git
a/list_utils.py
b/list_utils.py
index 74f1cf3078457d371194deb33ddf5ad6410ed599..7d3355cc85a72a047aacaa0c3f06430a9e8e8dd7 100644
(file)
--- a/
list_utils.py
+++ b/
list_utils.py
@@
-21,3
+21,9
@@
def flatten(lst: List[Any]) -> List[Any]:
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