-
Hi all, I've got this slightly annoying issue where a function returning I've combed through the internet, and found nothing pertaining this, which means one of two things: either I'm doing something incredibly wrong here, or I've hit just the sweet spot for some corner case. I'm leaning towards the former, but would appreciate getting some confirmation. Cheers |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I'll need to see your code or (preferably) a minimal code snippet that exhibits the problem you're seeing. To my knowledge, mypy doesn't track bound vs unbound variables. I'm not sure what you mean by "returning |
Beta Was this translation helpful? Give feedback.
-
Annotating a return type with I suspect it's a problem in the way you are importing `Any. Perhaps you are conditionally importing that symbol? Something like this: test: bool = False
if test:
from typing import Any
def foo() -> Any:
return 123 A few follow-up questions:
|
Beta Was this translation helpful? Give feedback.
Annotating a return type with
Any
quite common, so that in itself is not unusual. There must be something else about your configuration or code file that is resulting in this problem.I suspect it's a problem in the way you are importing `Any. Perhaps you are conditionally importing that symbol? Something like this:
A few follow-up questions:
Any
from?foo
function into its own ".py" file (and add an import statement), do you still see the problem?…