Describe the bug
The code below is correct in Python (A.f() returns the class), but Pyright reports an error.
As an additional reference, there was a similar issue in Ruff: astral-sh/ruff#20562
Code or Screenshots
class A:
f = lambda: __class__
"__class__" is not defined (reportUndefinedVariable)
VS Code extension or command-line
VS Code, same in playground
Describe the bug
The code below is correct in Python (
A.f()returns the class), but Pyright reports an error.As an additional reference, there was a similar issue in Ruff: astral-sh/ruff#20562
Code or Screenshots
"__class__" is not defined (reportUndefinedVariable)VS Code extension or command-line
VS Code, same in playground