Base Collection

class avblocks.object_collection.ObjectCollection

Bases: list, IImmutable, Generic[T]

An ordered collection of items used in AVBlocks. Implements the list interface with immutability support.

add(item: T)

Add an item to the collection.

append(item: T)

Append an item to the end of the list.

clear()

Remove all items from the list.

extend(iterable)

Extend the list by appending elements from the iterable.

property immutable: bool

Returns whether the object is immutable. An immutable object cannot be modified and all modifying methods fail to produce a result.

An immutable object can be modified by the AVBlocks library. Object immutability spreads to all nested objects. Therefore it is not possible to add/set an immutable object to a mutable object. When cloned an immutable object becomes mutable.

insert(index: int, item: T)

Insert an item at the specified index.

pop(index: int = -1)

Remove and return an item at the specified index.

remove(item: T)

Remove the first occurrence of an item.