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 collections.abc import Iterable, Callable | |
from typing import TypeVar, Optional | |
T = TypeVar('T') | |
def one(iterable: Iterable[T], condition: Callable[[T], bool] = bool) -> bool: | |
""" | |
Determines whether exactly one item in the iterable satisfies the given condition. |