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

Guide docs for all protocol methods #1032

Closed
davidhewitt opened this issue Jul 9, 2020 · 7 comments
Closed

Guide docs for all protocol methods #1032

davidhewitt opened this issue Jul 9, 2020 · 7 comments

Comments

@davidhewitt
Copy link
Member

Just thinking that for the guide it would be nice to add a table to the #[pyproto] section listing all the dunder methods that can be implemented and the protocols they are a part of (e.g. __int__ -> PyNumberProtocol etc.)

@davidhewitt
Copy link
Member Author

Please note for anyone who looks at this that the #[pyproto] methods are planned to be merged into #[pymethods], see #1206

@davidhewitt
Copy link
Member Author

After #[pymethods] are ready, the docs we need will probably be very similar to these excellent ones for Cython: https://cython.readthedocs.io/en/latest/src/userguide/special_methods.html

@birkenfeld
Copy link
Member

I volunteer for that.

@davidhewitt
Copy link
Member Author

Thanks! I think @mejrs also expressed desire to write something in #1864 ? You might want to double-check you don't end up duplicating effort.

@mejrs
Copy link
Member

mejrs commented Sep 20, 2021

I'm leaning towards this:

@birkenfeld
Copy link
Member

Sounds good to me. There is extensive material on the Python side on how these protocols work, and we should mainly state what we support and what the Rust/PyO3-specific snags are.

@davidhewitt
Copy link
Member Author

We now have https://pyo3.rs/v0.20.0/class/protocols, plus some more detailed examples by @mejrs and @birkenfeld for specific protocols. I'm going to close this one as resolved, though of course more documentation improvements are always possible!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants