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

Feature/Documentation: simpler FromPyObject for Python dict #3112

Closed
BlueGlassBlock opened this issue Apr 21, 2023 · 0 comments
Closed

Feature/Documentation: simpler FromPyObject for Python dict #3112

BlueGlassBlock opened this issue Apr 21, 2023 · 0 comments

Comments

@BlueGlassBlock
Copy link
Contributor

BlueGlassBlock commented Apr 21, 2023

The documentation of FromPyObject mentioned the usage of #[pyo3(item)], however I think it's quite feasible to have a #[pyo3(item_all)] on structs, which collects every field with get_item.

Apart from that, the pythonize project also provided the ability to build structs from Python dictionary, which worths mentioniing in the documentation as an alternative solution. However using #[pyo3(item_all)] should be easier for nested structures.

I'll work on the implementation and come up with a PR if #[pyo3(item_all)] is appropriate for PyO3 to have.

bors bot added a commit that referenced this issue May 4, 2023
3120: feat: add #[pyo3(from_item_all)] for FromPyObject r=davidhewitt a=BlueGlassBlock

This PR addresses #3112 by implementing ~~`#[pyo3(item_all)]`~~ `#[pyo3(from_item_all)]`.

Co-authored-by: BlueGlassBlock <blueglassblock@outlook.com>
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

1 participant