A mutable list of collected values.
Functions#
__init__#
__init__() -> Nonedef __init__(self) -> None:
self._values: list[object] = []add_all_unsafe#
add_all_unsafe(values) -> NoneAdds values to the collection, now.
| Parameter | Type | Description |
|---|---|---|
values | Iterable[object] |
def add_all_unsafe(self, values: Iterable[object]) -> None:
"""Adds ``values`` to the collection, now."""
self._values.extend(values)add_all#
add_all(values) -> Effect[None]Adds values to the collection. Never fails.
| Parameter | Type | Description |
|---|---|---|
values | Iterable[object] |
Returns Effect[None]
def add_all(self, values: Iterable[object]) -> Effect[None]:
"""Adds ``values`` to the collection. Never fails."""
return sync(lambda: self.add_all_unsafe(values))read_unsafe#
read_unsafe() -> list[object]The values collected so far, now: the collector's own list, not a copy.
Returns list[object]
def read_unsafe(self) -> list[object]:
"""The values collected so far, now: the collector's own list, not
a copy."""
return self._valuesread#
read() -> Effect[list[object]]The values collected so far (the collector's own list). Never fails.
Returns Effect[list[object]]
def read(self) -> Effect[list[object]]:
"""The values collected so far (the collector's own list). Never
fails."""
return sync(self.read_unsafe)clear_unsafe#
clear_unsafe() -> list[object]The values collected so far, leaving the collector empty.
Returns list[object]
def clear_unsafe(self) -> list[object]:
"""The values collected so far, leaving the collector empty."""
previous, self._values = self._values, []
return previousclear#
clear() -> Effect[list[object]]The values collected so far, leaving the collector empty. Never fails.
Returns Effect[list[object]]
def clear(self) -> Effect[list[object]]:
"""The values collected so far, leaving the collector empty. Never
fails."""
return sync(self.clear_unsafe)