py/json, py/statistics; demo: statistics.mean

This commit is contained in:
xushiwei
2024-05-14 20:53:13 +08:00
parent 73ad16dedd
commit 8c4d7bd641
6 changed files with 623 additions and 0 deletions

View File

@@ -18,6 +18,8 @@ package py
import (
_ "unsafe"
"github.com/goplus/llgo/c"
)
// https://docs.python.org/3/c-api/list.html
@@ -39,3 +41,53 @@ func (l *Object) ListLen() uintptr { return 0 }
//
// llgo:link (*Object).ListItem C.PyList_GetItem
func (l *Object) ListItem(index uintptr) *Object { return nil }
// Set the item at index index in list to item. Return 0 on success. If index is out
// of bounds, return -1 and set an IndexError exception.
//
// llgo:link (*Object).ListSetItem C.PyList_SetItem
func (l *Object) ListSetItem(index uintptr, item *Object) c.Int { return 0 }
// 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).
//
// llgo:link (*Object).ListInsert C.PyList_Insert
func (l *Object) ListInsert(index uintptr, item *Object) c.Int { return 0 }
// Append the object item at the end of list list. Return 0 if successful; return -1
// and set an exception if unsuccessful. Analogous to list.append(item).
//
// llgo:link (*Object).ListAppend C.PyList_Append
func (l *Object) ListAppend(item *Object) c.Int { return 0 }
// Return a list of the objects in list containing the objects between low and high.
// Return nil and set an exception if unsuccessful. Analogous to list[low:high].
// Indexing from the end of the list is not supported.
//
// llgo:link (*Object).ListSlice C.PyList_GetSlice
func (l *Object) ListSlice(low, high uintptr) *Object { return nil }
// Set the slice of list between low and high to the contents of itemlist. Analogous
// to list[low:high] = itemlist. The itemlist may be NULL, indicating the assignment
// of an empty list (slice deletion). Return 0 on success, -1 on failure. Indexing
// from the end of the list is not supported.
//
// llgo:link (*Object).ListSetSlice C.PyList_SetSlice
func (l *Object) ListSetSlice(low, high uintptr, itemlist *Object) c.Int { return 0 }
// Sort the items of list in place. Return 0 on success, -1 on failure. This is equivalent
// to list.sort().
//
// llgo:link (*Object).ListSort C.PyList_Sort
func (l *Object) ListSort() c.Int { return 0 }
// Reverse the items of list in place. Return 0 on success, -1 on failure. This is the
// equivalent of list.reverse().
//
// llgo:link (*Object).ListReverse C.PyList_Reverse
func (l *Object) ListReverse() c.Int { return 0 }
// Return a new tuple object containing the contents of list; equivalent to tuple(list).
//
// llgo:link (*Object).ListAsTuple C.PyList_AsTuple
func (l *Object) ListAsTuple() *Object { return nil }