Skip to content
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

PyList: add more sequence APIs #1849

Merged
merged 1 commit into from
Sep 1, 2021
Merged

PyList: add more sequence APIs #1849

merged 1 commit into from
Sep 1, 2021

Conversation

birkenfeld
Copy link
Member

See #1845

Since these are just literal copies of the sequence methods, this makes me think - could PyList deref to PySequence?

@birkenfeld
Copy link
Member Author

Now also forwarding the methods to PySequence instead of copy-pasting the impl.

@davidhewitt
Copy link
Member

Thanks, I've definitely come around to this being the right thing to do.

Since these are just literal copies of the sequence methods, this makes me think - could PyList deref to PySequence?

It's tempting, however I've been wondering also whether we should have Python types Deref to their Python base, just like what web-sys does. PyList deref to PySequence doesn't fit that pattern.

How about adding .as_sequence() method, and maybe even impl AsRef<PySequence> for PyList? That would also be useful within the implementation of these methods?

Also, needs CHANGELOG entry 😄

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me! I still think .as_sequence() could be useful, however I'm happy to see that as a separate PR...

@davidhewitt davidhewitt merged commit 921c441 into main Sep 1, 2021
@davidhewitt davidhewitt deleted the pylist_apis branch September 1, 2021 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants