ParamSpec on overloaded & generic functions
Discussions on Python.org
ParamSpec on overloaded & generic functions
Some thoughts on how ParamSpec interacts with generic and overloaded functions. Generic functions First example, with a generic function (works in mypy, pyright, ty, pyrefly, but not zuban): from collections.abc import Callable class CachedFunc[**P, R]: def __init__(self, inner: Callable[P, R]) -> None: self._inner: Callable[P, R] = inner self._cached: R | None = None def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R: if self._cached is None: ...
0 comments
No comments yet.