Generic type in an inner class #1607
Replies: 2 comments 1 reply
-
Mypy is correct to flag this as an error. The scoping rules for type variables (as documented in the Python typing spec) do not allow the use of a TypeVar bound to an outer class to be used within an inner class. |
Beta Was this translation helpful? Give feedback.
0 replies
-
OK, that's great, but what is the correct way to specify this? |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
I'm trying to use a generic type in a subclass, but it's failed
mypy==1.8.0
but
T
has the bound, and I've usedGeneric[T]
as the hint said. How can I fix it?Beta Was this translation helpful? Give feedback.
All reactions