basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

Special case `functools.partial`

Open KotlinIsland opened this issue 1 year ago • 1 comments

my_dataclass = functools.partial(dataclass, kw_only=True)

@my_dataclass
class A:
    doesnt_works: bool = True # 😭

It should remember the original thing being called, this would fix a lot of different problems.

KotlinIsland avatar Apr 09 '24 03:04 KotlinIsland

i don't think it needs special casing. functools.partial should use ParamSpec and Concatenate, its current signature sucks because it just uses Any:

class partial(Generic[_T]):
    ...
    def __call__(self, /, *args: Any, **kwargs: Any) -> _T: ...

DetachHead avatar Apr 09 '24 04:04 DetachHead