This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lightning talk @ DjangoCon EU 2022 | |
# Afonso Cerejeira <github.com/ajcerejeira> | |
# Intro | |
# ===== | |
# | |
# - Makefiles are a set of rules for building targets based on prerequisites; | |
# - Usually both targets and prerequisites represent filenames; | |
# - Makefiles define dependency graphs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable, Iterable, TypeVar | |
T = TypeVar("T") | |
def find(condition: Callable[[T], bool], iterable: Iterable[T]) -> T | None: | |
"""Finds the first element of an iterable that matches a given condition. | |
Arguments: | |
condition: A callable that returns a bool representingg wheter or not |