-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional class import #1107
Comments
Maybe Mypy could set |
That just might work. There are still some details that are non-obvious -- for example, what happens if the type of an attribute or a method argument is different is Implementation-wise, we could internally create a new class that is a subclass of only the common base classes of |
Wouldn't it effectively be treated as an |
No, that fails to ensure that every instance is of the same type (thus causing problems for binary operator overrides, among other things). However, I would think that |
This seem too difficult to fix relative to the benefit. Generally using |
It's pretty common to conditionally import a class. Here is a synthetic example:
It's not quite obvious how code like the above should be type checked, as
m1.C
andm2.CC
generally don't have identical interfaces.See also #649.
The text was updated successfully, but these errors were encountered: