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

(docs update) Focusing on FromPy rather than IntoPy #767

Merged
merged 1 commit into from
Feb 15, 2020

Conversation

gilescope
Copy link
Contributor

(as you get IntoPy for free)

Also try and point out that intoPy doesn't mean it's necessarily going to convert
something into a python object.

(as you get IntoPy for free)

Also try and point out that intoPy doesn't mean it's going to convert
something into a python object.
@gilescope
Copy link
Contributor Author

gilescope commented Feb 14, 2020

(If I've got anything wrong please wade in!) Is there any way we can make things clearer? I just want to make sure the next person doesn't think IntoPy will definitely return a py object.

@davidhewitt
Copy link
Member

This documentation looks good to me, thanks. I do agree that the naming of FromPy and IntoPy is potentially very confusing. I haven't at this point thought too hard about what a better design would be.

(E.g. I sort of wonder whether FromPy shouldn't exist, though I see why it does for symmetry with the types from std.)

@kngwyu
Copy link
Member

kngwyu commented Feb 15, 2020

Thank you!

@kngwyu kngwyu merged commit 0b5918e into PyO3:master Feb 15, 2020
@kngwyu
Copy link
Member

kngwyu commented Feb 15, 2020

I sort of wonder whether FromPy shouldn't exist, though I see why it does for symmetry with the types from std

We have various conversion traits.

  1. Convert Rust object to Python object (Rust<->Python object). FromPyObject, FromPyPointer, FromPy
  2. PyObject -> &'py PyAny conversion. AsPyRef
  3. Downcast(any to dict, list or so). PyTryFrom

I don't think FromPy is an ideal name, but I think PyTryFrom is the most confusing name and should fix it as priority.

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