-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
False-negative when instantiating a class before its constructor is defined #2324
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
Oh, interesting. This could be dealt with by deferring the first method when the class signature isn't known yet. But we'd need some kind of flag to tell us whether we've processed Do you feel up to trying to submit a PR for this? No pressure! |
I could work on that, any tips what module/function to begin from? |
Best place to get help would be https://gitter.im/python/mypy.
|
Bumping priority because this seem to happen with some frequency and the workaround is not easy to figure out. |
This is a dupe of #1727, which is older and has more discussion; going to close this one and make the other one high-pri. |
It seems as if any method can call any method, so a two-pass system might work best. Once to process all of the function signatures, then another to process the code. |
Thanks for the advice. |
I've found a small bug:
This complains at line 5,
Too many arugments for "Operation"
. Swapping these two methods around (init before randomize) fixed the issue.Looks like mypy tried to type-check
cls(config)
before learning whatOperation
's constructor looks like.The text was updated successfully, but these errors were encountered: