modular / modular/modular

[Feature Request] Add a sorted(iterable) builtin

Open
#7,159 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug_feature_triaged enhancement mojo Team: Mojo Libraries
Dominant language
Mojo
Stars
29.8k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

Review Mojo's priorities
What is your request?

Python has this, so I think mojo should have this too. This is mostly a convinience function, but relatively common from my rust experience.

Performance

We could either add overloads for owned Lists, which turn this into a sort or we could use type and trait reflection to avoid unnecessary copying.

Note: #2390 already exists. But this proposal is more precise and #2930 seems to be stale.

What is your motivation for this change?

N/A

Any other details?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing sort functionality and the related issues #2390 and #2930. Define the sorted(iterable) behavior against Python's sorted builtin, then determine whether the implementation should use owned List overloads or type and trait reflection; done means the builtin works without unnecessary copying.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.