-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SLOT: Classes with multiple base classes #15879
Comments
Could you explain what's the bug experience? I don't think I understand it from the issue. Ruff does raise an error about a missing Playground: https://play.ruff.rs/45b205ae-153c-4a73-8fe6-29995ef0a5c9 |
@MichaReiser To clarify, what is the behavior if a class has two ancestors, and only one of them implements |
Oh, I see. That's a good point. In that case, I'd say it's not a false positive, at least not when the base class is under the user's control. However, the suggested fix/message is misleading because only adding Now, analyzing base classes is something that Ruff struggles with, at least if they're defined in another file. Which is why I'm leaning towards leaving the rule as is for now and revisit it once we have better type inference. |
Description
^ suggests a fixit here. This is the recommended class structure for old versions of python before strenum was introduced. However, enum doesn't have slots defined, so defining ai also see this bug happen when a class has multiple ancestors, one of which is a tuple.__slots__
wouldn't be that helpful.Actually, nevermind, this error was actually masking another error where enum was not properly imported. Seems odd to suggest a fixit in this situation. In other cases though, I do see the error pop up when only one of the ancestors is a tuple.
The text was updated successfully, but these errors were encountered: