pub fn new<T: ToPyObject>(py: Python, elements: &[T]) -> Py<PyTuple> {
        unsafe {
            let len = elements.len();
            let ptr = ffi::PyTuple_New(len as Py_ssize_t);
            for (i, e) in elements.iter().enumerate() {
                ffi::PyTuple_SetItem(ptr, i as Py_ssize_t, e.to_object(py).into_ptr());
            }
            Py::from_owned_ptr_or_panic(ptr)
        }
    }
/// Construct a new tuple with the given elements.
Construct a new tuple with the given elements.
Construct a new tuple with the given elements .
pub fn new<T: ToPyObject>(py: Python, elements: &[T]) -> Py<PyTuple> {
        unsafe {
            let len = elements.len();
            let ptr = ffi::PyTuple_New(len as Py_ssize_t);
            for (i, e) in elements.iter().enumerate() {
                ffi::PyTuple_SetItem(ptr, i as Py_ssize_t, e.to_object(py).into_ptr());
            }
            Py::from_owned_ptr_or_panic(ptr)
        }
    }
pub fn new < T : ToPyObject > ( py : Python , elements : & [ T ] ) -> Py < PyTuple > { unsafe { let len = elements . len ( ) ; let ptr = ffi :: PyTuple_New ( len as Py_ssize_t ) ; for ( i , e ) in elements . iter ( ) . enumerate ( ) { ffi :: PyTuple_SetItem ( ptr , i as Py_ssize_t , e . to_object ( py ) . into_ptr ( ) ) ; } Py :: from_owned_ptr_or_panic ( ptr ) } }
Construct a new tuple with the given elements.
Construct a new tuple with the given elements .
py
Python
elements
&[T]
py
Python
elements
&[T]