-
Notifications
You must be signed in to change notification settings - Fork 899
add as_tuple() method to PyList
#3042
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
Conversation
davidhewitt
left a comment
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.
Looks good other than the change on the .gitignore which I'm not convinced is necessary!
davidhewitt
left a comment
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!
bors r+
|
Build succeeded: |
|
I would prefer a |
I see that but it would be less obvious what's going on, and why the reverse can't be done. |
Actually this is a great point, I think the reverse could be implemented by However this also makes me notice another snag, which is naming convention. This is
|
|
The |
|
👍 for |
|
Pushed #3043 and I'll add separate PRs for other renaming and also |
3043: `PyList::as_tuple()` -> `PyList::to_tuple()` r=mejrs a=davidhewitt As discussed as a follow-up to #3042 Co-authored-by: David Hewitt <[email protected]>
3043: `PyList::as_tuple()` -> `PyList::to_tuple()` r=mejrs a=davidhewitt As discussed as a follow-up to #3042 Co-authored-by: David Hewitt <[email protected]>
3111: Rename sequence `.list()` and `.tuple()` to `.to_list()` and `.to_tuple()` r=adamreichold a=davidhewitt As agreed in #3042 (comment). The motivation is that it is an emerging Rust convention for `to_x` to mean "a non-consuming conversion to type x which has some (small) overhead". E.g. `to_string`, `to_owned`. Co-authored-by: David Hewitt <[email protected]>
3111: Rename sequence `.list()` and `.tuple()` to `.to_list()` and `.to_tuple()` r=adamreichold a=davidhewitt As agreed in #3042 (comment). The motivation is that it is an emerging Rust convention for `to_x` to mean "a non-consuming conversion to type x which has some (small) overhead". E.g. `to_string`, `to_owned`. Co-authored-by: David Hewitt <[email protected]>
From benchmarks, this is significantly faster than
PyTuple::new(py, the_list):