-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Confusing error message when class definition duplicated across if-else #1874
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
Yeah, this is a common issue. There are plans to fix this but they haven't landed yet. For now, just put |
It seems like there are (at least) two or three things that could be done here:
I think fixing the last point would in itself mitigate the confusing wording a lot, because it'd be totally explicit what other definition the checker has in mind and the user can figure out that that might be a problem even when they're never duplicated at runtime. So if nothing else, we should add a |
*Partial* fix for #1874 - just improve the error message. The duplicate definitions in different if/else branches are still not allowed.
The message is now |
I have a block of code that looks like this:
mypy complains for the second class definition:
However, this is technically not true.
The text was updated successfully, but these errors were encountered: