Option to include params of Annotated (pep593) types #4045
Replies: 2 comments
-
When you hover over an expression with your mouse pointer or call The problem with PEP 593 says that a type checker should ignore all arguments to For those reasons, I don't think it makes sense for a type checker or language server to do anything with an |
Beta Was this translation helpful? Give feedback.
-
I had the thought that it might be nice to be able to see the extra params given to
Annotated
in eg. editor hoverdocs. The current behavior is correct according to the PEP, so I don't propose any changes to what Pyright itself does withAnnotated
other than including the extra params in its output if the user opts-in to that behavior.To borrow an example from PEP 539:
It shouldn't be necessary to resolve any expressions that might appear in the params list since the results of evaluating any such expression would only be meaningful to a runtime consumer and, ostensibly, a human reading it in a hoverdoc should already have some idea of what the expression would do at runtime. Just reporting the raw text should be sufficient.
Any thoughts? Is it even possible? (or god forbid, has this come up before and I missed it in my search before writing this?)
Beta Was this translation helpful? Give feedback.
All reactions