-
Notifications
You must be signed in to change notification settings - Fork 758
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: add type overview #801
Conversation
Obviously unfinished, but I'd like feedback if the style is ok... |
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 like what you've written so far. Thanks so much for doing this. When I first came to pyo3 my head was totally boggled by all this too.
Is it also worth adding a note somewhere about references, e.g. that we must use &PyAny
rather than PyAny
(at least until improvements from #679 land)?
guide/src/types.md
Outdated
* explain: GIL lifetime | ||
* explain: mutability? | ||
|
||
## Smart pointers |
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.
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.
Indeed, that was one question I was going to pose to y'all :)
guide/src/types.md
Outdated
**Conversions:** | ||
|
||
- To `&PyAny`: `.as_ref(py)` | ||
- To `Py<ConcreteType>`: ??? |
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 I'd like Py::new()
to be able to do this one day, but that's a breaking API change.
guide/src/types.md
Outdated
**Conversions:** | ||
|
||
- To `&PyAny`: `.as_ref(py)` | ||
- To `Py<ConcreteType>`: ??? |
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.
We can use obj.as_ref(py).extract::<Py<ConcreteType>>
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.
OK, that's good to know!
Thank you, it's really easy to read. |
What specifically do you have in mind here?
OK, I'll try to find a spot to integrate this. |
Just like what you've added as |
fixes PyO3#789 Co-Authored-By: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Co-Authored-By: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
Thank you! |
fixes #789