Module better_functools.strict.builtins

Override builtin functional helpers with stricter better typed versions.

Functions

def filter(fn: Callable[[T], bool], it: Iterable[T]) ‑> Iterator[T]
Expand source code
def filter[T](fn: Callable[[T], bool], it: Iterable[T]) -> Iterator[T]:
    return orig_filter(fn, it)
def map(fn: Callable[[T], R], it: Iterable[T]) ‑> Iterator[R]
Expand source code
def map[T, R](fn: Callable[[T], R], it: Iterable[T]) -> Iterator[R]:
    return orig_map(fn, it)
def sum(it: Iterable[int]) ‑> int
Expand source code
def sum(it: Iterable[int]) -> int:
    return orig_sum(it)
def zip2(it1: Iterable[T1], it2: Iterable[T2]) ‑> Iterator[tuple[T1, T2]]
Expand source code
def zip2[T1, T2](it1: Iterable[T1], it2: Iterable[T2]) -> Iterator[tuple[T1, T2]]:
    return orig_zip(it1, it2)
def zip3(it1: Iterable[T1], it2: Iterable[T2], it3: Iterable[T3]) ‑> Iterator[tuple[T1, T2, T3]]
Expand source code
def zip3[T1, T2, T3](
    it1: Iterable[T1], it2: Iterable[T2], it3: Iterable[T3]
) -> Iterator[tuple[T1, T2, T3]]:
    return orig_zip(it1, it2, it3)
def zip4(it1: Iterable[T1], it2: Iterable[T2], it3: Iterable[T3], it4: Iterable[T4]) ‑> Iterator[tuple[T1, T2, T3, T4]]
Expand source code
def zip4[T1, T2, T3, T4](
    it1: Iterable[T1], it2: Iterable[T2], it3: Iterable[T3], it4: Iterable[T4]
) -> Iterator[tuple[T1, T2, T3, T4]]:
    return orig_zip(it1, it2, it3, it4)
def zip5(it1: Iterable[T1],
it2: Iterable[T2],
it3: Iterable[T3],
it4: Iterable[T4],
it5: Iterable[T5]) ‑> Iterator[tuple[T1, T2, T3, T4, T5]]
Expand source code
def zip5[T1, T2, T3, T4, T5](
    it1: Iterable[T1],
    it2: Iterable[T2],
    it3: Iterable[T3],
    it4: Iterable[T4],
    it5: Iterable[T5],
) -> Iterator[tuple[T1, T2, T3, T4, T5]]:
    return orig_zip(it1, it2, it3, it4, it5)