-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[stdlib] adding le, lt, gt, ge for Codepoint #5464
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
base: main
Are you sure you want to change the base?
Conversation
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds rich comparison dunder methods (lt, le, gt, ge) to Codepoint and extends tests to exercise comparison behavior.
- Implements four new comparison methods delegating to underlying u32 value.
- Adds unit tests invoking the new methods directly.
- Updates documentation via new docstrings for each method.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
mojo/stdlib/stdlib/collections/string/codepoint.mojo | Adds comparison operator methods with accompanying docstrings. |
mojo/stdlib/test/collections/test_codepoint.mojo | Adds tests for the new comparison functionality using direct dunder invocation. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Args: | ||
other: The codepoint value to compare against. | ||
Returns: | ||
True if this character's values is greater than or equal the other codepoint values; |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar: missing 'to' after 'equal', and plural/singular mismatch; suggested: 'True if this character's value is greater than or equal to the other codepoint value;'.
True if this character's values is greater than or equal the other codepoint values; | |
True if this character's value is greater than or equal to the other codepoint value; |
Copilot uses AI. Check for mistakes.
We can/should now put |
updated here: 86c0f1d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! And welcome to Mojo 🔥
I've approved the PR and I'll sync it in shortly. Before doing so, do you mind also adding a changelog entry here please so others know about your new enhancement? Thanks!
fn __lt__(self, other: Self) -> Bool: | ||
"""Return True if this character is less than a different codepoint value from | ||
`other`. | ||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we usually leave newlines between these sections, please follow other docstring in the same file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added here: 7fb0311
addresses #5373
Implementing lt, le, gt, ge for Codepoint