Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upProvide comparison between PyO3 and rust-cpython #55
Comments
This comment has been minimized.
This comment has been minimized.
|
at this point, base concepts, compared to rust-cpython, are totally different.
rust-cpython: impl PyList {
fn new(py: Python) -> PyList {...}
fn get_item(&self, py: Python, index: isize) -> PyObject {...}
}pyo3: impl PyList {
fn new(py: Python) -> &PyList {...}
fn get_item(&self, index: isize) -> &PyObject {...}
}Because pyo3 allows only references to python object, all refs uses Gil lifetime. So |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
motivation
downsides:
|
This comment has been minimized.
This comment has been minimized.
ssokolow
commented
Jul 23, 2017
|
In that case, definitely something I'll be switching over to once it's possible to resolve #5. |
This comment has been minimized.
This comment has been minimized.
|
I used rust-cpython, and had occasional segfaults. never got any response from author. |
This comment has been minimized.
This comment has been minimized.
ssokolow
commented
Jul 23, 2017
|
In that case, once I've finished migrating as much of my project to the Rust side as possible, if I encounter segfaults and can't resolve them, maybe I'll drop to something lower-level like Snaek. ...or just port everything back to pure Python. Avoiding dependency on nightly Rust is non-negotiable. |
This comment has been minimized.
This comment has been minimized.
|
I hope proc_macro will be stabilized by the end of year. |
This comment has been minimized.
This comment has been minimized.
|
Just landed pretty big change.
for example: use pyo3::*;
fn parse_int(s: String) -> PyResult<usize> {
Ok(s.parse::<usize>()?)
}The code snippet above will raise |
This comment has been minimized.
This comment has been minimized.
|
closing, there is link in readme |
ssokolow commentedJul 23, 2017
•
edited
When I come to the PyO3 frontpage, having never seen PyO3 before, my first questions are "how is this different from rust-cpython?" and "Why would I want to use this instead?"
So far, all I've been able to determine is:
ToPyObjectimpls being this long in rust-cpython.It'd be a good idea to add a blurb to the README explaining: