Fix merge sort comparable clean - #15259
Conversation
4425c11 to
a4c0f55
Compare
|
Hi! The PR is ready for review. The latest changes have been pushed and the pre-commit checks are passing. The remaining workflows are currently awaiting maintainer approval. Thank you! |
Corrected minor grammatical errors in docstring.
|
@priya-sundaram-dev, your review, please. |
priya-sundaram-dev
left a comment
There was a problem hiding this comment.
Thanks @kadubhumika — the merge_sort.py change itself looks good. The Comparable protocol with just __lt__, the PEP 695 merge_sort[T: Comparable] generic, and the switch to a strict < comparison (which keeps the sort stable and only depends on the one dunder the protocol declares) are all consistent. I verified it against ints, floats, and strings and the doctests pass.
One thing to fix before this can go in: the diff also touches DIRECTORY.md with a bunch of unrelated machine-learning / physics / neural-network entries. Those aren't part of this change — they're an artifact of the branch being behind master. Could you sync your branch with upstream master and revert DIRECTORY.md so this PR only touches sorts/merge_sort.py? (The checklist item "This PR only changes one algorithm file" is what the maintainers look for.) Once DIRECTORY.md is clean this is good to go from my side.
|
It is important to always refresh your |
Description
Makes
merge_sort.pysupport any comparable items instead of only relying on untyped lists.Changes:
ComparableprotocolTypeVarmerge_sort()to use generic type hintsPart of #15234
Checklist