You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a lot of the Python typing functions, we can determine the type of args from the arguments. For example, if you have a Union (or the union by | ing types), __args__ is a tuple[type[...]].
Some similar inference could be done here. The current annotation of tuple[Any, ...] is correct but it would be nicer if interacting with __args__ in the runtime (such as pulling values out of a Literal).
Extension version: 2024.11.3
VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Darwin x64 24.0.0
Modes:
The text was updated successfully, but these errors were encountered:
The __args__ parameter for UnionType objects is defined here in the typeshed stubs. In general, pyright does not override the types provided in typeshed. Doing so usually leads to maintenance and correctness issues.
In general, static type checkers do not concern themselves with the runtime representation of type forms (objects that result from the runtime evaluation of type expressions). This is the domain of runtime type checkers.
For these reasons, I'm going to reject this enhancement request.
Type: Feature Request
For a lot of the Python typing functions, we can determine the type of args from the arguments. For example, if you have a Union (or the union by
|
ing types),__args__
is atuple[type[...]]
.Example:
The type checker could reasonably guess the types in that instance without me having to explicitly annotate it. Another example using literals:
Some similar inference could be done here. The current annotation of
tuple[Any, ...]
is correct but it would be nicer if interacting with__args__
in the runtime (such as pulling values out of a Literal).Extension version: 2024.11.3
VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Darwin x64 24.0.0
Modes:
The text was updated successfully, but these errors were encountered: