ListStorage 类

可存储/查询可迭代数据的列表存储容器。

构造函数

ListStorage()

方法

append

将值同步追加到列表中。

async_append

将值异步追加到列表中。

async_clear

异步清除列表中的所有项。

async_filter

使用谓词异步筛选项。

async_items

以异步方式将所有项作为列表返回。

async_length

返回项数。

async_pop

异步删除并返回最后一个值。

clear

同步清除列表中的所有项。

filter

使用谓词同步筛选项。

items

以同步方式将所有项作为列表返回。

length

返回项数。

pop

同步删除并返回最后一个值。

append

将值同步追加到列表中。

abstract append(value: V) -> None

参数

名称 说明
value
必需

async_append

将值异步追加到列表中。

abstract async async_append(value: V) -> None

参数

名称 说明
value
必需

async_clear

异步清除列表中的所有项。

abstract async async_clear() -> None

async_filter

使用谓词异步筛选项。

abstract async async_filter(predicate: Callable[[V, int], bool]) -> List[V]

参数

名称 说明
predicate
必需

async_items

以异步方式将所有项作为列表返回。

abstract async async_items() -> List[V]

async_length

返回项数。

abstract async async_length() -> int

async_pop

异步删除并返回最后一个值。

abstract async async_pop() -> V | None

clear

同步清除列表中的所有项。

abstract clear() -> None

filter

使用谓词同步筛选项。

abstract filter(predicate: Callable[[V, int], bool]) -> List[V]

参数

名称 说明
predicate
必需

items

以同步方式将所有项作为列表返回。

abstract items() -> List[V]

length

返回项数。

abstract length() -> int

pop

同步删除并返回最后一个值。

abstract pop() -> V | None