libtmux Reference MCP Search
On this page

libtmux._internal.sparse_array.SparseArray.add

View as Markdown

Module
libtmux._internal.sparse_array
Declared in
SparseArray
Package
libtmux
Source
src/libtmux/_internal/sparse_array.py
add ( self , index : int , value : T ) None
method [source]
method [source]
add

Add a value at a specific index.

Examples

>>> from libtmux._internal.sparse_array import SparseArray
>>> arr: SparseArray[str] = SparseArray()
>>> arr.add(0, "hook at index 0")
>>> arr.add(10, "hook at index 10")
>>> arr[0]
'hook at index 0'
>>> arr[10]
'hook at index 10'
>>> sorted(arr.keys())
[0, 10]
Parameters
  • index ( int ) – The index at which to store the value.

  • value ( T ) – The value to store.

0 declared, 0 inherited

Esc

Type to search.