-
Notifications
You must be signed in to change notification settings - Fork 279
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
RFC: rewrite find_lowest_subclasses to better match its intent #4411
RFC: rewrite find_lowest_subclasses to better match its intent #4411
Conversation
I'm not against dropping my PR in favour of this one in principle, but could explain why this extra bit of behaviour is needed or desired ? |
It's not needed for any existing code, but I think it's a bit more future-proof. I'm fine with either implementation (the way they work is identical except for that edge case), but the extra tests should be added either way. |
Actually I cannot find an implementation that doesn't survive your new tests (both #4405 and the main branch seem to pass them). Since your original post suggests you're adding new behaviour, this may indicate that you're not actually testing what you aimed for. |
I could add a test for a class being in |
I think it's safe that this function assumes unicity of candidates, though maybe it should be mentioned in the docstring. |
@yut23 I think we could merge your tests and my implementation. Would that work for you ? |
Sounds good to me! |
Then could you include my implementation here ? This seems like the easiest way to avoid conflicts. |
b083bdf
to
15487c0
Compare
PR Summary
This implementation is more straightforward than the original one with fewer edge cases that need special handling.
It ended up being quite similar to the final implementation in #4405, except it can handle having the same class show up in candidates more than once.
It simply makes a set of all the superclasses of the candidates, and filters out any candidates that appear in that set.