pyo3 icon indicating copy to clipboard operation
pyo3 copied to clipboard

LinkedList<T> to PyList conversion

Open JPDye opened this issue 2 years ago • 2 comments

Resolves #2405

Has been mentioned on Discord that converting a LinkedList<T> to a PyList could be surprising for users.

JPDye avatar Jun 09 '22 17:06 JPDye

What would the alternative be? As a data point pybind11 converts std::list to Python lists. https://github.com/pybind/pybind11/blob/0e956a2e4f7838fc26f42a6399bc358ae7248134/include/pybind11/stl.h#L200

davidhewitt avatar Jun 09 '22 20:06 davidhewitt

CI failure is because impl<T, const N: usize> From<[T; N]> for LinkedList<T> is only available for Rust 1.56+. vec![1,2.3].into_iter().collect() is a decent way to make one for a test, I think.

What would the alternative be? As a data point pybind11 converts std::list to Python lists. https://github.com/pybind/pybind11/blob/0e956a2e4f7838fc26f42a6399bc358ae7248134/include/pybind11/stl.h#L200

I mean, they're very different data structures. I'm not convinced that linkedlist -> pylist is the obvious thing to do.

mejrs avatar Jun 09 '22 21:06 mejrs