pyaiml21.session.bounded_list.BoundedList

class pyaiml21.session.bounded_list.BoundedList(maxsize: Optional[int] = None)[source][source]

Represents a bounded list, a list with predefined max size.

Methods

add

Add new item to the list, possibly overwriting the oldest item.

Attributes

capacity

Get the number of items currently in the list.

is_infinite

Return True if the list is infinite.

maxsize

Maximal size of the list, or None for infinite list.

add(item: Any) None[source][source]

Add new item to the list, possibly overwriting the oldest item.

Place item into the list, if the capacity is more than maxsize and list is finite, overwrite the oldest item on the list.

Implementation note: change if allowed removing

Parameters

item – item to place into the list

property capacity: int[source]

Get the number of items currently in the list.

property is_infinite: bool[source]

Return True if the list is infinite.

maxsize[source]

Maximal size of the list, or None for infinite list.