Core LibrarystableAPI Reference

Choose documentation 3

stable

Current version

stable
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

method libtmux stable

SparseArray.append

Append a value at the next available index (max + 1).

Source and package
Qualified name
libtmux._internal.sparse_array.SparseArray.append
Module
libtmux._internal.sparse_array
Declared in
SparseArray
Package
libtmux
Source
src/libtmux/_internal/sparse_array.py
append (self, value: T) → None

Examples#

>>> from libtmux._internal.sparse_array import SparseArray

Appending to an empty array starts at index 0:

>>> arr: SparseArray[str] = SparseArray()
>>> arr.append("first")
>>> arr[0]
'first'

Appending to a non-empty array adds at max index + 1:

>>> arr.add(5, "at index 5")
>>> arr.append("appended")
>>> arr[6]
'appended'
>>> arr.append("another")
>>> arr[7]
'another'
Type parameters
Parameters
  • value (T) # – The value to append.

Esc

Type to search.

Reference preview Open reference