Accessing the static members on a bounded type parameter #7814
Replies: 1 comment 4 replies
-
I don't understand what you're trying to do here, so I don't have any suggestions. You asked "Given a type parameter It appears you're trying to access attributes of type variables which isn't allowed in the Python type system. I'm not even sure what that would mean. You're also using If you have questions about the Python static type system in general, the Python typing forum is a good place to post questions. |
Beta Was this translation helpful? Give feedback.
-
So I've run into a problem which I suspect may be a brick wall in the capabilities of the Python type annotation system. Given a type parameter
T
, bounded to a protocolP
that affords aV: ClassVar[...]
, how do I accessV
? Here's a more concrete example:I understand why this error is occurring, but I'm not sure how to get around it...
I recognize that I may be trying to fix a square peg into a round whole. I'm experimenting with translating the "Trees that Grow" design pattern for compiler tree decoration from Haskell to Python, using the comment found here for reference. More generally, I am trying to represent Haskell type families in Python.
Beta Was this translation helpful? Give feedback.
All reactions