Replies: 1 comment
-
What your proposing here would need to be codified in the Python typing spec if you want pyright (or other standards-compliant Python type checkers) to support it. If you'd like to pitch the idea to the Python typing community, the best place to do that is the Python typing forum. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When a decorator "consumes" the decorated function, by not returning anything (None) therefore replacing the function with None, this could have 2 meanings:
Specifically: I'm running into this problem with a web framework where different HTTP methods are different decorators, and the function name is the html template name. This means I always have to ignore reportRedeclaration errors, even though the previous declaration isn't a function that can be called, since the decorator returns None.
I've tried hinting that the decorator returns NoReturn but this just caused funcname to be of type "NoReturn" (which feels wrong...)
i've no clue if this is something pyright could solve (by understanding NoReturn or Never in this place), or which needs to be solved by the python typing module introducing a new special cased type for this. i just wanted to throw the idea out there,
Beta Was this translation helpful? Give feedback.
All reactions