-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Question: List of instances / Callables? #4358
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
Comments
You need to narrow the type to
And that should typecheck. |
@ethanhs You're right, but Is there some limitation on MyPy about parent/child classes? (I have a lot of classes extending from |
@izn This isn't really a problem with mypy, more of a constraint of nominal static typing. Since you annotated |
I've started testing mypy on an application, but I don't get success when trying to work with
instances of class
.ButtonGenerator.__new__
+buttons
should accept a List ofBaseButton
(URLButton) or simply aBaseButton
instance.buttons.py
Errors
Example:
print(ButtonGenerator(URLButton('https://github.com/python/mypy')))
I tried with List of Callable also.
Am I doing it wrong?
The text was updated successfully, but these errors were encountered: