コード例 #1
0
ファイル: sequence.go プロジェクト: gward/go-python
// int PyList_Insert(PyObject *list, Py_ssize_t index, PyObject *item)
// Insert the item item into list list in front of index index. Return 0 if successful; return -1 and set an exception if unsuccessful. Analogous to list.insert(index, item).
//
// Changed in version 2.5: This function used an int for index. This might require changes in your code for properly supporting 64-bit systems.
func PyList_Insert(self *PyObject, index int, item *PyObject) error {
	err := C.PyList_Insert(topy(self), C.Py_ssize_t(index), topy(item))
	return int2err(err)
}
コード例 #2
0
ファイル: list.go プロジェクト: ericsnowcurrently/qur-gopy
// Insert adds the Object obj to list l, by inserting it before the value
// currently stored at index idx (making obj the new value with index idx).
// This is equivalent to the Python "l.insert(idx, obj)".
func (l *List) Insert(idx int64, obj Object) error {
	ret := C.PyList_Insert(c(l), C.Py_ssize_t(idx), c(obj))
	return int2Err(ret)
}