func (o *object) Length(t *Thread) (l int, err error) { t.execute(func() { size := C.PySequence_Size(o.pyObject) if size < 0 { err = getError() return } l = int(size) }) return }
// decodeSequence translates a Python object to a Go array. func decodeSequence(pySequence *C.PyObject) (array []interface{}, err error) { length := int(C.PySequence_Size(pySequence)) array = make([]interface{}, length) for i := 0; i < length; i++ { pyValue := C.PySequence_GetItem(pySequence, C.Py_ssize_t(i)) if pyValue == nil { err = getError() return } var value interface{} if value, err = decode(pyValue); err != nil { return } array[i] = value } return }
func (s *SequenceProtocol) Size() (int64, error) { ret := C.PySequence_Size(csp(s)) return ssize_t2Int64Err(ret) }