Skip to content

Conversation

olekskrav
Copy link
Contributor

If n >= size == len(iterable), then there is no need to do slicing in sorted(iterable)[:n] — it would just return the duplicate copy of sorted(iterable) which is a redundancy.

If n >= size == len(iterable), then there is no need to do slicing -- it would return the same list. Currently, it just creates a duplicate copy of the same list.
@rhettinger rhettinger merged commit 444ebaf into python:main Sep 18, 2025
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants