-
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
Bikeshedding names: Py
and PyObject
#873
Comments
Py
and PyObject
Py
and PyObject
I've used PyO3 on some projects for my previous employer, I'm doing some work on rust-numpy rn, and I've been planning to use PyO3 in an existing project (https://github.com/PTNobel/AutoDiff). I'll say that I don't know what I personally don't like the type name of |
PyRc makes me think I can't pass it safely between threads as its rc rather than arc. There's a lot of 'Py' in pyo3 - it's not particularly distinguishing given how much its used... |
Another name that I wonder about for |
This seems to be more of an open discussion rather then a concrete thing we want to get done. I believe that since it has been open for more than an year with no real traction we should leave the naming as is for now. |
Do we want to deprecate+remove the alias |
I would also like to not have I was personally planning to leave the current pair of names as-is, and in #1308 introduce replacements (probably just |
Was just going to write a long thing about this in a new issue, but since this exists, I'll do it here.
|
Just going to bump this, with an example. I think renaming Current API: // Create a Python list that can be stored without holding the GIL;
// notice that Py and py have opposite meanings!
let list: Py<PyList> = PyList::empty(py).into();
// Create another Py<PyList> that points to the same underlying Python list:
let list2 = list.clone();
// Get a reference to the underlying list that we can more easily interact with:
let direct_reference_to_list: &PyList = list.as_ref(py); With // Create a Python list that can be stored without holding the GIL:
let list: O3Rc<PyList> = PyList::empty(py).into();
// Create another O3Rc<PyList> that points to the same underlying Python list;
// notice that because it's called O3Rc it's much clearer that this doesn't actually
// copy the underlying data, at least to Rust programmers:
let list2 = list.clone();
// Get a reference to the underlying list that we can more easily interact with:
let direct_reference_to_list: &PyList = list.as_ref(py) |
A third usage of "py" (in addition to |
Sorry for not replying faster. I still am generally in support of making some renaming here, although I think it will require a solid new proposal as well as already a good migration plan to make this feasible for users. I agree with your categorization of the three usages of the "py" name as conflicting at the moment. My current "ideal" solution is related to #1056 and to give With For |
I think having two kinds of |
Given |
I am certainly tempted to do that. The one thing holding me back is that "contexts" as a future Rust feature might remove the need to have For removing |
Having written this fairly innocent comment in #863:
It seems like a few people had ideas and opinions about what we could do on this point, mostly focussing on renaming
Py
.Rather than let that discussion sidetrack from discussion in #863, I thought it best to open this issue.
The current names
Py
, andPyObject
are fine, though I am always open to improving things if there's a strong community opinion for one thing over another. To be clear though, a rename of such core pieces like this would cause a lot of churn to all pyo3 users - so if we do this, let's wait until we're totally confident on the names we like, and then do the rename once only.Some proposals of alternative names for
Py
:PyRc
Some proposals of alternative names for
PyObject
:The text was updated successfully, but these errors were encountered: