Inserts an item at the specified index. Panics if the index is out of range.
(&self, _py: Python, index: usize, item: PyObject)
| 76 | /// |
| 77 | /// Panics if the index is out of range. |
| 78 | pub fn insert(&self, _py: Python, index: usize, item: PyObject) { |
| 79 | let r = unsafe { ffi::PyList_Insert(self.0.as_ptr(), index as Py_ssize_t, item.as_ptr()) }; |
| 80 | assert!(r == 0); |
| 81 | } |
| 82 | |
| 83 | // Old name for `insert`. |
| 84 | #[deprecated(since = "0.3.1", note = "use list.insert() instead")] |