Replies: 1 comment
-
|
I agree that this shouldn't result in an error because the annotation I've created this bug report to track the issue. |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Given a generic instance variable on a class which is bound to a specific type. Is it ambiguous to access this variable as long as I treat the variable as the type it is bound to?
Here is some example code to hopefully get my point across:
In this example, the
modelfield on theMyBaseClassclass is bound toBaseModel.I would have assumed that as long as I treat access to
cls.modelinfuncthe same as I would if it were typed astype[BaseModel]that nothing ambiguous has occured.Is this something that could/should be supported? If not I'd be interested in knowing why just for myself to learn from :)
Example without pydantic dependency:
There are some similar discussion but none that I've found which include the use of a bound generic:
Beta Was this translation helpful? Give feedback.
All reactions