Closed timrid closed 1 week ago
Pyright is working as intended here. The callable(x)
type guard behavior is dictated by the typeshed definition of the callable
function, which is defined as follows:
def callable(obj: object, /) -> TypeIs[Callable[..., object]]: ...
The isinstance(x, T)
type guard behavior is provided by custom logic within pyright.
Describe the bug I would expect that the following two examples are equal, but
callable(param)
creates an error since pyright v1.1.385.Code or Screenshots
VS Code extension or command-line VSCode pylance v2024.11.1 or pyright since v1.1.385 (in v1.1.384 it was not an error)