Functional Weave
Code in Python

todo.list@1.1.0

impl/python/remove_todo.py

349 bytes · the Python implementation · view raw

Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.

from typing import List, Sequence

from .todo_item import Todo  ← from todo.item ^1.0.0 · built alongside by fune
from .todo_list_update_todo import index_of_todo  ← updateTodo, another function of this group · built into the same file, even by a slim install


def remove_todo(todos: Sequence[Todo], id: str) -> List[Todo]:
    """Delete one todo; the others keep their order values (gaps are harmless)."""
    at = index_of_todo(todos, id)
    return [t for i, t in enumerate(todos) if i != at]