Replies: 1 comment
-
Both of these approaches should work fine. We'll need additional details to diagnose the problem you're seeing. In your example, you are importing from a module called In your examples above, none of these annotations are forward references, so using quotes for the type annotations is unnecessary. Is there a reason you want to use quotes here? You might also want to consider the use of |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Referring to PEP 484, on the subject of forward references, one can use "module.class" for a valid type hinting. Pylance interprets the type correctly.
For various reasons, in our project, we'd rather want the imports to be more like this:
If I do this, the code compiles without a hitch, but Pylance will not infer the types in vs-code, meaning "argument.bar" in the method "A.foo" will be grayed out, making development more difficult.
Is there a setting to enable this type of hinting? Thank you
Beta Was this translation helpful? Give feedback.
All reactions